记录编号 598218 评测结果 AAAAAAAAAA
题目名称 [NOIP 2013PJ]表达式求值 最终得分 100
用户昵称 Gravatar梧叶已同秋雨去 是否通过 通过
代码语言 C++ 运行时间 0.115 s
提交时间 2025-01-22 17:21:07 内存使用 3.40 MiB
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
long long a,b,t[100005],f,sum;
char c;
int main(){
freopen("expr2013.in","r",stdin);
freopen("expr2013.out","w",stdout);
cin>>a;
   f++;
   t[f]=a;
   while(cin>>c>>b){
       if(c=='+'){
           f++;
           t[f]=b;
       }else{
           t[f]*=b;
       }t[f]%=10000;
//       cout<<f<<" "<<t[f]<<" ";
   }
   for(int i=1;i<=f;i++){
       sum+=t[i];
   //    cout<<t[i]<<" ";
       sum%=10000;
   }cout<<sum;
    return 0;
}