求助,玄学问题
查看原帖
求助,玄学问题
366595
zty_luogu楼主2021/8/30 00:42

为什么同一道题在洛谷评测姬上AC,在这里就wa了呢

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define f(III,MMM,NNN) for(register int III=MMM;III<=NNN;III++)
typedef long long int ll;
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3f
//#define Int int
//#define Long long
//#define Double double
//#define For for
//#define While while
//#define Do do
const int N=1010;
stack <ll> s;
int main(){
//ios::sync_with_stdio(false);
//cin.tie(0);
//cout.tie(0);
	ll c;
	int a=0;
	while(c=getchar()){
		if(c=='@')
			break;
		if(c>='0'&&c<='9')
			a=a*10+c-'0';
		if(c=='.')
			s.push(a),a=0;
		if(c=='+'){
			int x=s.top();
			s.pop();
			int y=s.top();
			s.pop();
			s.push(x+y);
		}
		if(c=='-'){
			int x=s.top();
			s.pop();
			int y=s.top();
			s.pop();
			s.push(y-x);
		}
		if(c=='*'){
			int x=s.top();
			s.pop();
			int y=s.top();
			s.pop();
			s.push(x*y);
		}
		if(c=='/'){
			int x=s.top();
			s.pop();
			int y=s.top();
			s.pop();
			s.push(y/x);
		}
	}
	cout<<s.top();
	return 0;
}

2021/8/30 00:42
加载中...