提交时间:2024-08-21 17:21:29

运行 ID: 180696

#include<bits/stdc++.h> using namespace std; #define Mod 10000 stack <int> n; int main() { int a,b; char c; cin>>a; a=a%Mod; n.push(a); while(cin>>c>>b) { if(c=='*') { a=n.top(); n.pop(); n.push(a*b%Mod); } else n.push(b); } short ans=0; while(!n.empty()) { a=(a+n.top())%Mod; n.pop(); } cout<<a<<endl; return 0; }