IT/코딩 문제 풀이
[JAVA] 백준 2161 카드1
다날92
2018. 1. 3. 23:45
import java.util.*;
public class Main {
private static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
Queue q = new LinkedList();
int N = sc.nextInt();
for(int i=1;i<=N;i++){
q.offer(i);
}
while(!q.isEmpty()){
Object out = q.poll();
System.out.print(out+" ");
if(q.isEmpty())
break;
Object in = q.poll();
q.offer(in);
}
}
}