Skip to content

Commit 68e6258

Browse files
committed
85차 1번 문제 다시 풀이
1 parent 1e08fc9 commit 68e6258

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

live8/test85/문제1/박희경.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import sys
2+
3+
input = sys.stdin.readline
4+
5+
6+
t = int(input())
7+
for _ in range(t):
8+
n = int(input())
9+
x = list(map(int, input().split()))
10+
11+
dic_x = set(x)
12+
x.sort() # -4, -1, 0, 2, 4
13+
14+
cnt = 0
15+
16+
for i in range(n): # ??..?
17+
for j in range(i + 1, n):
18+
dist = x[j] - x[i] # 두 점 사이 거리 (x[j]: 중간점)
19+
if x[j] + dist in dic_x:
20+
cnt += 1
21+
22+
print(cnt)
23+
"""
24+
2
25+
5
26+
2 0 -4 -1 4
27+
5
28+
1 3 2 5 4
29+
"""

0 commit comments

Comments
 (0)