P1981[NOIP2013 普及组] 表达式求值
代码
#include<bits/stdc++.h>
using namespace std;
stack<int>stk;
int main()
{
int a,b,ans;
char c;
cin>>b;
stk.push(b);
while(cin>>c>>a)
{
if(c=='*')
{
int x=stk.top();
stk.pop();
stk.push(x%10000*a%10000);
}
else
stk.push(a);
}
while(stk.empty()==false)
{
ans+=stk.top();
stk.pop();
ans=ans%10000;
}
cout<<ans;
return 0;
}
测试结果
有人会问你发这么多东西干吗?
现在告诉你,我的代码下载数据本地测没半点问题,到评测机上却全是问题,问一下怎么解决?