분류 전체보기
-
2164) 카드2 c++백준코딩일기 2020. 11. 4. 19:48
문제 ) www.acmicpc.net/problem/2164 2164번: 카드2 N장의 카드가 있다. 각각의 카드는 차례로 1부터 N까지의 번호가 붙어 있으며, 1번 카드가 제일 위에, N번 카드가 제일 아래인 상태로 순서대로 카드가 놓여 있다. 이제 다음과 같은 동작을 카드가 www.acmicpc.net 풀이 ) N 을 입력 받았을 경우를 생각해야하는데, 문제에 나온 예시로 생각을 해보자. 예를 들어 N=4 라고 입력을 받았다면, 카드는 제일 위에서부터 1234 의 순서로 놓여있다고 했으므로 for 문을 이용해서 1부터 N까지 순차적으로 입력을받고, "1을 버리면 234가 남는다." 고 했으니 ------> q.pop() "여기서 2를 제일 아래로 옮기면 342가 된다." ---> int front 라..