
[문제 링크]
https://www.acmicpc.net/problem/2164
[입출력 예]
[소스코드]
| #include <iostream> |
| #include <string> |
| #include <queue> |
| #define endl '\n' |
| using namespace std; |
| |
| int main(void) { |
| ios::sync_with_stdio(0); |
| cin.tie(0); |
| queue<int> Q; |
| |
| int n; |
| cin>>n; |
| |
| for(int i=1; i<=n; i++){ |
| Q.push(i); |
| } |
| while(Q.size()!=1){ |
| Q.pop(); |
| Q.push(Q.front()); |
| Q.pop(); |
| } |
| cout<<Q.front(); |
| return 0; |
| } |
| |
댓글을 사용할 수 없습니다.