Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
119265 | 林垦 | 表达式求值 | C++ | 通过 | 100 | 19 MS | 464 KB | 368 | 2024-01-05 13:26:49 |
#include <bits/stdc++.h> using namespace std; stack <int> x; int main() { int a,b; char c; cin>>a; int m=10000; a=a%m; x.push(a); while(cin>>c>>b) { if(c=='*') { a=x.top(); x.pop(); x.push(a*b%m); } else x.push(b); } a=0; while(x.size()) { a+=x.top(); a%=m; x.pop(); } cout<<a<<endl; return 0; }