全WA
查看原帖
全WA
547446
Nevergonna_CCF楼主2021/12/26 15:08
#include<cstdio>
#include<stack>
using namespace std;

stack<int> num;
long long ans=0;
int a;
char b;

int main(){
	scanf("%d",&a);
	num.push(a);
	while(scanf("%c",&b)!=EOF){
		scanf("%d",&a);
		if(b=='*'){
			int l=num.top();
			num.pop();
			num.push(l*a);
		}
		else{
			num.push(a);
		}
	}
	while(!num.empty()){
		ans+=num.top();
		num.pop();
	}
    printf("%lld",ans%10000);
    return 0;
}
2021/12/26 15:08
加载中...