tijie--shit tao

陈柏诚  •  2年前


include<bits/stdc++.h>

using namespace std;

define Mod 10000

stack n; int main() { //freopen("enpr.in","r",stdin); //freopen("enpr.out","w",stdout); int a,b; char c; cin>>a; a=a%Mod; n.push(a); while(cin>>c>>b) {

if(c=='*')//乘号的话就把之前的栈顶*b给存进去 
{
  a=n.top();
  n.pop();
  n.push(a*b%Mod);//%Mod防止爆掉 
}
else
  n.push(b);

} short ans=0;//四位数用short就可以 while(!n.empty()) {

a=(a+n.top())%Mod;
n.pop();

} cout<<a<<endl; return 0; }


评论:

最好使用Markdown。


ZZQ  •  2年前

add&thx


mod998244353  •  2年前