提交时间:2024-01-05 13:45:06

运行 ID: 119308

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