반응형
백준 1966
https://www.acmicpc.net/problem/1966
from collections import deque
n = int(input())
for i in range(n):
k,idx = map(int,input().split())
q = deque(list(map(int, input().split())))
ans = 0
while q:
max_v = max(q)
tmp = q.popleft()
idx -= 1
if max_v == tmp:
ans += 1
if idx < 0:
print(ans)
break
else:
q.append(tmp)
if idx<0:
idx = len(q)-1
반응형
'algorithm test' 카테고리의 다른 글
[baekjoon 백준][python] 2108 (0) | 2023.02.14 |
---|---|
[프로그래머스][python]게임맵최단거리 DFS&BFS (0) | 2023.02.14 |
[baekjoon 백준][python] 20044 greedy (0) | 2023.02.02 |
[baekjoon 백준][python] 5585 greedy (0) | 2023.02.02 |
[baekjoon백준][python] 2839 (2) | 2023.02.02 |