记录编号 | 382930 | 评测结果 | AAAAAAAAAA | ||
---|---|---|---|---|---|
题目名称 | 1425.[NOIP 2013PJ]表达式求值 | 最终得分 | 100 | ||
用户昵称 | 是否通过 | 通过 | |||
代码语言 | C++ | 运行时间 | 0.028 s | ||
提交时间 | 2017-03-14 20:43:40 | 内存使用 | 0.29 MiB | ||
#include<cstdio> using namespace std; const int M=10000; char ch; int product=1,num=0,ans=0; int main() { freopen("expr2013.in","r",stdin); freopen("expr2013.out","w",stdout); while((ch=getchar())!='\n') { if((ch=='*')) { product=product*num%M; num=0; } else if(ch=='+') { ans=(ans+num*product)%M; product=1; num=0; } else { num=(num*10+ch-'0')%M; } } printf("%d\n",(ans+num*product)%M); return 0; }