-
코드
n = int(input()) li = sorted(list(map(int, input().split(" ")))) x = int(input()) answer = 0 start = 0 end = n-1 while start < end: plus = li[start] + li[end] if plus == x: answer += 1 if plus < x: start += 1 else: end -= 1 print(answer)
'알고리즘 > 백준' 카테고리의 다른 글
[백준] 1167번 트리의 지름 (파이썬) (0) 2022.01.05 [백준] 11725번 트리의 부모 찾기 (파이썬) (0) 2022.01.05 [백준] 11404번 플로이드 (파이썬) (0) 2022.01.05 [백준] 11657번 타임머신 (파이썬) (0) 2022.01.05 [백준] 1504번 특정한 최단 경로 (파이썬) (0) 2022.01.05