Skip to content

Commit

Permalink
Create S4_2164
Browse files Browse the repository at this point in the history
  • Loading branch information
RangKoon authored Jul 10, 2024
1 parent d632d74 commit e68b1ed
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions 진민혁/S4_2164
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import java.util.*;
import java.io.*;

public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

int n = Integer.parseInt(br.readLine());
Queue<Integer> q = new LinkedList<>();
for(int i=1; i<=n; i++) {
q.add(i);
}
while(q.size() != 1) {
q.poll();
int tmp = q.poll();
q.add(tmp);
}
System.out.println(q.peek());
}
}

0 comments on commit e68b1ed

Please sign in to comment.