2个WA#2#6错了
查看原帖
2个WA#2#6错了
767015
sd_JC楼主2023/10/22 13:41

https://www.luogu.com.cn/record/130993845

#include <bits/stdc++.h>
using namespace std;
stack<int>n;
char c;
int s=0,x,y;
int main(){
    while(c!='@'){
    	c=getchar();
    	if(c=='@')break;
	    else if('0'<=c&&c<='9')
          s=s*10+c-'0';
	    else if(c=='.'){
          n.push(s);s=0;
       	}
	    else{
			x=n.top(); n.pop(); 
			y=n.top(); n.pop();
			if(c=='+')n.push(x+y);
			if(c=='-')n.push(y-x);
			if(c=='*')n.push(x*y);
			if(c=='/')n.push(x/y);
		}
    }
    cout<<n.top();
    return 0;
}
2023/10/22 13:41
加载中...