Skip to content

Commit

Permalink
B_2164
Browse files Browse the repository at this point in the history
  • Loading branch information
likppi10 committed Oct 19, 2021
1 parent 2e8f85e commit 8cfdb79
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Algorithm_Baek/Baek/B_2164_카드2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package Queue;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class B_2164_카드2 {
static Queue<Integer> queue = new LinkedList<>();
public static void main(String srgs[]) {
Scanner sc = new Scanner(System.in);

int card = sc.nextInt();
cardmove(card);
sc.close();
}

static void cardmove(int card) {
for(int i=1 ; i<=card; i++) queue.offer(i);
while(queue.size() != 1) {
queue.poll();
queue.offer(queue.poll());
}
System.out.print(queue.poll());
}
}

0 comments on commit 8cfdb79

Please sign in to comment.