first commit
from old repository to a new repository
This commit is contained in:
24
boj/3273.py
Normal file
24
boj/3273.py
Normal file
@@ -0,0 +1,24 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user