0分WA代码求调
  • 板块P1165 日志分析
  • 楼主_QrSn_
  • 当前回复2
  • 已保存回复2
  • 发布时间2022/7/25 18:49
  • 上次更新2023/10/27 18:27:36
查看原帖
0分WA代码求调
511253
_QrSn_楼主2022/7/25 18:49

Code:

#include<bits/stdc++.h>
using namespace std;
stack<int>a;
int _max=-10000,n,x,y;
int main() {
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>x;
		if(x==0)
		{
			cin>>y;
			if(y>_max){_max=y;a.push(y);}
		}
		if(x==1&&a.empty()==false){a.pop();}
		if(x==2)
		{
			if(a.empty())cout<<0<<endl;
			else cout<<a.top()<<endl;
		}
	}
	return 0;
}

全部WA,样例没过,但是思路和题解都差不多了,没找出错在哪

2022/7/25 18:49
加载中...