a2lyaXNhbWUgbWFyaXNh @ 2022-07-18 09:47:21
然额样例都没过
上一遍没人看到,再发一遍
#include<bits/stdc++.h>
using namespace std;
char s[100];
int tmp,opnmX,opnmY;
stack<int> line;
int main() {
scanf("%s",s);
for(int i=0; i<strlen(s); i++) {
if(s[i]>='0'&&s[i]<='9') {
tmp=tmp*10+s[i]-'0';
} else if(s[i]=='.') {
line.push(tmp);
} else {
if(s[i]=='+') {
opnmX=line.top();
line.pop();
opnmY=line.top();
line.pop();
line.push(opnmY+opnmX);
}
if(s[i]=='-') {
opnmX=line.top();
line.pop();
opnmY=line.top();
line.pop();
line.push(opnmY-opnmX);
}
if(s[i]=='*') {
opnmX=line.top();
line.pop();
opnmY=line.top();
line.pop();
line.push(opnmY*opnmX);
}
if(s[i]=='/') {
opnmX=line.top();
line.pop();
opnmY=line.top();
line.pop();
line.push(opnmY/opnmX);
}
if(s[i]=='@') {
printf("%d",line.top());
return 0;
}
}
}
}
lz患有重度STL依赖症
by Hisaishi_Kanade @ 2022-07-18 09:48:42
tmp要不断赋零
by a2lyaXNhbWUgbWFyaXNh @ 2022-07-18 09:49:10
@bye_wjx 谢谢OVO%%%%
by Hisaishi_Kanade @ 2022-07-18 09:49:19
} else if(s[i]=='.') {
line.push(tmp);
tmp=0;
} else {
by a2lyaXNhbWUgbWFyaXNh @ 2022-07-18 09:52:24
@bye_wjx 铭记大佬%%%
by a2lyaXNhbWUgbWFyaXNh @ 2022-07-18 09:52:54
AC.,此帖终
by 喵仔牛奶 @ 2022-07-18 09:59:24
我在上一个贴回了qwq
上一个贴是被您删了吗qwq