Skip to content

Commit d28fc0b

Browse files
committed
90차 1번 문제 풀이
1 parent cc697c7 commit d28fc0b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import sys
2+
3+
input = sys.stdin.readline
4+
5+
n = int(input())
6+
a = sorted(list(map(int, input().split())))
7+
x = int(input())
8+
9+
i, j = 0, n - 1
10+
cnt = 0
11+
while i < j:
12+
total = a[i] + a[j]
13+
if total == x:
14+
cnt += 1
15+
i += 1
16+
j -= 1
17+
elif total > x:
18+
j -= 1
19+
else:
20+
i += 1
21+
22+
print(cnt)

0 commit comments

Comments
 (0)