개요
- BOJ 2164 카드2
C++
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N, temp;
cin >> N;
queue<int> q;
for(int i=1; i<=N; i++) {
q.push(i);
}
while(true) {
if(q.size()<2) break;
q.pop();
if(q.size()<2) break;
temp = q.front();
q.pop();
q.push(temp);
}
cout << q.front();
}