wgl2009 @ 2021-04-10 15:53:43
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<stack>
using namespace std;
int zhan[1000000],top,t;
int a,b;
int main()
{
string s;
cin>>s;
for(int i=1;i<s.length()-1;i++)
{
if(s[i]>='0'&&s[i]<='9')
{
t=t*10+(s[i]-'0');
t=0;
}
if(s[i]=='.')
{
if(s[i]=='+')
{
b=zhan[--top];
a=zhan[--top];
zhan[t]=a+b;
}
if(s[i]=='-')
{
b=zhan[--top];
a=zhan[--top];
zhan[t]=a-b;
}
if(s[i]=='*')
{
b=zhan[--top];
a=zhan[--top];
zhan[t]=a*b;
}
if(s[i]=='/')
{
b=zhan[--top];
a=zhan[--top];
zhan[t]=a/b;
}
}
}
cout<<zhan[t]<<endl;
}
提交记录
by leaf_叶子 @ 2021-04-10 16:35:11
emm.......(保持沉默)
by wgl2009 @ 2021-04-12 09:51:36
@leaf_叶子
emmmmmmmmmmmmmmmmmm......
by leaf_叶子 @ 2021-04-12 09:55:47
有意思吗,你直接问老师不香吗