全RE,救命!
查看原帖
全RE,救命!
677091
MnZnOIer楼主2023/7/8 10:55

啊啊啊,我实在逝不明白了,上代码。

#include<bits/stdc++.h>
using namespace std;
stack<int>s;
char c;
int main(){
	int sum=0;
	while(cin>>c&&c!='@'){
		if(c>='0'&&c<='9')sum*=10,sum+=int(c-'0');
		if(c=='.')s.push(sum),sum=0;
		int a,b;
		a=s.top();
		s.pop();
		b=s.top();
		s.pop();
		if(c=='+')s.push(a+b);
		if(c=='-')s.push(a-b);
		if(c=='*')s.push(a*b);
		if(c=='/')s.push(a/b);
	}
	cout<<s.top();
	return 0;
}

我真的是想骂人想哭 焯呜呜呜

2023/7/8 10:55
加载中...