황소개발자
백준 1966 파이썬 python : 프린터 큐 @@황소처럼 우직하게@@ 본문
반응형
import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
n, m = map(int, input().split())
info = list(map(int, input().strip().split()))
info = [[x, idx] for idx, x in enumerate(info)]
ans = 0
while True:
if info[0][0] == max(info)[0]:
ans += 1
if info[0][1] == m:
print(ans)
break
else:
info = info[1:]
else:
info = info[1:] + info[:1]
옆에 인덱스 붙여서 이중리스트로 풀었다
반응형
'백준 문제 풀이' 카테고리의 다른 글
| 백준 14889 파이썬 python : 스타트와 링크 @@황소처럼 우직하게@@ (0) | 2020.02.27 |
|---|---|
| 파이썬 리스트 빼기 리스트 : 리스트 차집합 한줄로 구현하기 (0) | 2020.02.26 |
| 백준 1182 파이썬 python : 부분수열의 합 @@황소처럼 우직하게@@ (0) | 2020.02.26 |
| 백준 2504 파이썬 python : 괄호의 값 @@황소처럼 우직하게@@ 원리를 알면 참 재밌는 문제 (0) | 2020.02.26 |
| 백준 14499 파이썬 python : 주사위 굴리기 @@황소처럼 우직하게@@ 깔끔하게 풀기 (0) | 2020.02.26 |
Comments