写炸力QWQ,只有50tps
查看原帖
写炸力QWQ,只有50tps
352918
I_think_so_i_am_here楼主2023/10/1 19:57
#include<bits/stdc++.h>
using namespace std;
string s;
long long last,sum,all,l=1;
stack<int> p;
int main(){
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]>='0'&&s[i]<='9')sum=(sum*10+s[i]-'0')%10000;
		else if(s[i]=='+')p.push((sum*max(last,l))%10000),sum=0,last=0;
		else if(s[i]=='*')last=(sum*max(last,l))%10000,sum=0;
	}
	last=(max(last,l)*max(sum,l))%10000;
	while(!p.empty()){
		all=(all+p.top())%10000;
		p.pop();
	}
	cout<<(last+all)%10000<<endl;
    return 0;
}
2023/10/1 19:57
加载中...