BBY123 @ 2024-03-21 16:37:19
#include<iostream>
#include<stack>
#include<string>
using namespace std;
stack<int> z;
long long ans,a;
char h;
string s;
int main(){
cin>>s;
for(int i = 0;i <= s.size();i++){
if(s[i]>='0'&&s[i]<='9'){
a*=10;
a+=s[i]-'0';
}
else if(s[i]=='.'){
z.push(a);
a=0;
}
if(s[i]=='@'){
cout<<ans<<endl;
return 0;
}
else{
if(s[i]=='+'){
ans+=z.top();
z.pop();
}
else if(s[i]=='-'){
ans+=z.top();
z.pop();
ans=z.top()-ans;
z.pop();
}
else if(s[i]=='*'){
ans*=z.top();
z.pop();
}
else if(s[i]=='/'){
ans+=z.top();
z.pop();
ans=z.top()/ans;
z.pop();
}
}
}
return 0;
}
by HYD2010 @ 2024-03-21 16:39:06
rj