#include <bits/stdc++.h>
using namespace std;
int main(){
stack <int> s;
int a, b, number = 0, sum = 0;
char c;
while (c != '@'){
c = getchar();
if (c == '0'){
s.push(number)
number = 0;
continue;
} if (c >= '0' && c <= '9') number = number * 10 + (c - '0');
else {
a = s.top(); s.pop();
b = s.top(); s.pop();
if (c == '+') s.push(a + b);
else if (c == '-') s.push(a - b);
else if (c == '*') s.push(a * b);
else if (c == '/') s.push(b / a); }}
cout << s.top();
return 0;
}
2021年12月4日放在了草稿箱,翻的时候发现的
导致现在才投稿
猜猜我在写什么?