Files
PS/boj/3273.py
Gyubin Han 2600340c03 first commit
from old repository to a new repository
2024-04-30 16:59:10 +09:00

24 lines
375 B
Python

import sys
n=int(sys.stdin.readline().rstrip())
arr=list(map(int,sys.stdin.readline().rstrip().split()))
x=int(sys.stdin.readline().rstrip())
count=0
start=0
end=n-1
arr.sort()
while True:
if start==end:
break
res=arr[start]+arr[end]
if res==x:
count+=1
end-=1
elif res>x:
end-=1
else:
start+=1
print(count)