Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
118433 临时1 表达式求值 C++ 通过 100 19 MS 456 KB 595 2023-12-30 11:18:34

Tests(10/10):


#include <iostream> #include <stack> 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//将b存入 x.push(b); } a=0; while(x.size()) { a+=x.top(); a%=m;//取模是万恶之源 x.pop(); } cout<<a<<endl; return 0; }


测评信息: