diff --git "a/\354\247\204\353\257\274\355\230\201/S4_2164" "b/\354\247\204\353\257\274\355\230\201/S4_2164" new file mode 100644 index 0000000..579ba8f --- /dev/null +++ "b/\354\247\204\353\257\274\355\230\201/S4_2164" @@ -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 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()); + } +}