백준 풀이

백준 1966번 파이썬

ag2개발자 2022. 8. 30. 14:13
t = int(input())
for _ in range(t):
    
    
    n,k=map(int,input().split())
    
    a=list((map(int,input().split())))
    b=[x for x in range(n)]
    cnt=0
    b[k]="*"
    while True:
        if a[0]==max(a):
            cnt+=1
            if b[0]=="*":
                print(cnt)
                break
            else:
                a.pop(0)
                b.pop(0)
        else:
            a.append(a.pop(0))
            b.append(b.pop(0))

'백준 풀이' 카테고리의 다른 글

백준 1541번 파이썬  (0) 2022.08.30
백준 14501번 파이썬  (0) 2022.08.30
백준 2805번 파이썬 이분탐색  (0) 2022.08.30
백준 14888번 파이썬 dfs  (0) 2022.08.30
백준 11724번 파이썬 (dfs)  (0) 2022.08.29