提交时间:2024-08-21 11:10:09
运行 ID: 178066
#include <bits/stdc++.h> using namespace std; stack <int> stk; int m = 10000; int main(){ int a, b; char c; a =a % 10000; cin >> a; stk.push(a); while(cin >> c >> b){ if(c == '*'){ a = stk.top(); stk.pop(); stk.push(a * b); } else { stk.push(b); } } int ans = 0; while(!stk.empty()){ ans = (ans + stk.top()) % 10000; stk.pop(); } cout << ans; return 0; }