「CODEVS3185 – 3187」队列练习1, 2, 3

2013年12月26日2,4018

队列练习1http://codevs.com/problem/3185/

队列练习2http://codevs.com/problem/3186/

队列练习3http://codevs.com/problem/3187/

 

avatar
1 Comment threads
7 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
2 Comment authors
希望能脚踏实地hzwer Recent comment authors
  Subscribe  
提醒
希望能脚踏实地

hzwer神牛,能不能看下,我这拿错了.队列练习1
感激不尽,跪大神。

#include<iostream>
#include<cstdio>
#include<queue>
using namespace std;
queue<int>q;
int main()
{
int n;
cin>>n;
while(n–)
{
int a,b;
cin>>a;
if(a==1)
{
cin>>b;
q.push(b);
}
else if(a==2)
{
if(!q.empty())
cout<<q.back()<<endl;
else
cout<<"impossible!"<<endl;
}
}
return 0;
}

希望能脚踏实地

本人,大二渣渣……

希望能脚踏实地

第一题少了一个int main()