We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e658fe5 commit 2d0f005Copy full SHA for 2d0f005
1 file changed
김지호/10주차/260305.py
@@ -0,0 +1,35 @@
1
+# https://www.acmicpc.net/problem/10431
2
+# 줄세우기, 실버5
3
+
4
+import sys
5
+sys.stdin = open("../../../input.txt",'r')
6
7
+P = int(input()) # 시도 횟수
8
9
10
+def solve():
11
+ inputs = list(map(int,input().split(" ")))
12
+ step = inputs[0]
13
+ numbers = inputs[1:]
14
15
+ answer = 0
16
17
+ length = len(numbers)
18
19
+ array = []
20
+ for i in range(length):
21
+ isIn = False
22
+ for j in range(i):
23
+ if numbers[i] < array[j]:
24
+ array.insert(j,numbers[i])
25
+ answer += i-j
26
+ isIn = True
27
+ break
28
29
+ if isIn == False:
30
+ array.append(numbers[i])
31
32
+ print(f"{step} {answer}")
33
34
+for _ in range(P):
35
+ solve()
0 commit comments