18分?!
查看原帖
18分?!
422110
HgSO4_QwQ楼主2021/7/21 14:50
#include<iostream>
#include<stack>
#include<queue>
using namespace std;

int a[10110110];

int Solve()
{
	char a;
	stack<int> s;
	while(cin>>a)
	{
		if(a=='.') continue;
		if(a=='@') 
		{
			break;
		}
		if(a>='0'&&a<='9') s.push(a-'0');
		else
		{
			int t2=s.top();
            s.pop();
			int t1=s.top();
            s.pop();
			if(a=='+') s.push(t1+t2);
			else if(a=='-') s.push(t1-t2);
			else if(a=='*') s.push(t1*t2);
			else if(a=='/') s.push(t1/t2);
		}		
	}  
    cout<<s.top();
}
int main()
{
	Solve();
	return 0;
}
2021/7/21 14:50
加载中...