求助

wuhongzhen 2020-11-21 8:36:04 14 返回题目

本人测试点2过不去 help help help!!!

其实直接发代码也是行的

{{ vote && vote.total.up }}

共 3 条回复

wuhongzhen

蟹蟹(好家伙迟到2年

thomaswcy
#include <bits/stdc++.h>
using namespace std;
stack<int> s;
int main()
{
	int n;
	cin>>n;
	int x,p;
	for(int i=1;i<=n;i++)
	{
		cin>>p;
		if(p==1)
		{
			cin>>x;
		  	s.push(x);
		}
		else
			s.pop();
	}
	if(s.empty())
		cout<<"impossible!";
	else
		cout<<s.top();
}
wuhongzhen

救命啊~~~~~