import sys
from collections import deque
for i in range(int(sys.stdin.readline())):
a,b=map(int,sys.stdin.readline().split()) # a문서의 갯수,b는 몇번째로 출력되는지 알고싶은 인덱스
d=deque(map(int,sys.stdin.readline().split()))
di=deque(range(a))
cnt=0
while d:
if d[0]==max(d):
cnt += 1
d.popleft()
if di[0]==b:
print(cnt)
break;
else:
di.popleft()
else:
d.append(d.popleft())
di.append(di.popleft())
'알고리즘 > 백준' 카테고리의 다른 글
백준-2108번(통계학)-python3 (0) | 2023.11.24 |
---|---|
백준-1978번(소수 찾기)-python3 (0) | 2023.11.24 |
백준-1934번(최소공배수)-python3 (0) | 2023.11.24 |
백준-1932번(정수 삼각형)-python3 (0) | 2023.11.24 |
백준-1929번(소수 구하기)-python3 (0) | 2023.11.24 |