쉬운 문제..
import sys
T = int(sys.stdin.readline())
for i in range(T):
ans = 0
N, M = map(int, sys.stdin.readline().split())
tc = list(map(int, sys.stdin.readline().split()))
tm = [0] * N
tm[M] = 1
popData = max(tc)
while True:
tempM = tm.pop(0)
tempC = tc.pop(0)
if tempC == popData:
ans += 1
if tempM == 1:
break
popData = max(tc)
else:
tc.append(tempC)
tm.append(tempM)
print(ans)
'Algorithm > Implementaion' 카테고리의 다른 글
[백준] 1913번 달팽이 (0) | 2020.11.26 |
---|---|
[백준] 1032번 명령 프롬프트 (0) | 2020.11.25 |
[백준] 7568번 덩치 (0) | 2020.11.25 |
[백준] 5622번 다이얼 (0) | 2020.11.24 |
[백준] 2875번 대회 or 인턴 (0) | 2020.11.23 |
댓글