# ~~为什么不用队列呢?~~
## ~~队列永远的神!(cuoluan)~~
### 用队列先进先出的特点,比较两个数,再将入队,直到最后剩下两个数,取较小数(亚军),输出它的编号就完了
```c
#include<iostream>
#include<cstdio>
#include<cmath>
#include<queue>
using namespace std;
const int mx=1e4+10;
queue<int> q;
int id[mx];
int main(){
int n;
cin>>n;
n=pow(2,n);
for(int i=1;i<=n;i++){
int x;cin>>x;q.push(x);id[i]=x;
}
int x,y;
while(q.size()>2){
x=q.front();q.pop();
y=q.front();q.pop();
x=max(x,y);
q.push(x);
}
x=q.front();q.pop();
y=q.front();q.pop();
x=min(x,y);
for(int i=1;i<=n;i++){
if(id[i]==x){
cout<<i;
return 0;
}
}
return 0;
}
```
by boycyh @ 2022-10-16 11:52:31