[백준/Python] 11866번 : 요세푸스 문제 0
문제
https://www.acmicpc.net/problem/11866
큐를 활용하는 문제
풀이
Python의 deque를 활용하여 양방향 큐를 사용해 큐를 순회하면서 K번째 요소를 순차적으로 pop한 뒤, 이 요소들로 새로운 배열을 만들어 리턴한다.
from collections import deque
N, K = map(int, input().split())
# 1 ~ N까지 순열 생성
queue = deque(range(1, N+1...
studio-pendant.hashnode.dev1 min read