Skip to content

Commit 821ba5b

Browse files
committed
[BOJ] 프린터 큐 / 실버 3 / 40분
https://www.acmicpc.net/problem/1966
1 parent 20cd4d4 commit 821ba5b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
t = int(input())
2+
3+
for _ in range(t):
4+
n, m = map(int, input().split())
5+
data = list(map(int, input().split()))
6+
7+
result = 1
8+
while data:
9+
if data[0] < max(data):
10+
data.append(data.pop(0))
11+
12+
else:
13+
if m == 0: break
14+
15+
data.pop(0)
16+
result += 1
17+
18+
m = m - 1 if m > 0 else len(data) - 1
19+
20+
print(result)

0 commit comments

Comments
 (0)