2 条题解
- 
  1
#include <iostream> #include <stack> using namespace std; int main(){ int a,b,ans=0; char op; cin>>a; stack<int>st; st.push(a); while(cin>>op>>b){ b%=10000; if(op=='+')st.push(b); else if(op=='*'){ ans=st.top(); st.pop(); ans=ans*b; st.push(ans%10000); } } ans=0; while(!st.empty()){ ans+=st.top(); st.pop(); ans%=10000; } cout<<ans<<endl; return 0; } - 
  0
#include<bits/stdc++.h> using namespace std; string m; long long s1[5000000],n=0; char s2[500000]; int main(){ cin>>m; int x=1,y=1; for(int i=0;i<m.size();i++){ if(m[i]>='0'&&m[i]<='9'){ s1[x]=s1[x]*10+m[i]-'0'; } else{ x++; s2[y++]=m[i]; } } for(int i=1;i<y;i++){ if(s2[i]=='*'){ s1[i+1]=s1[i]*s1[i+1]%10000; s1[i]=0; } } for(int i=1;i<=x;i++){ n+=s1[i]; } cout<<n%10000; return 0; } 
- 1
 
信息
- ID
 - 729
 - 时间
 - 1000ms
 - 内存
 - 256MiB
 - 难度
 - 7
 - 标签
 - 递交数
 - 144
 - 已通过
 - 38
 - 上传者