| ps | |
|---|---|
| 링크 | acmicpc.net/… |
| 출처 | BOJ |
| 문제 번호 | 3273 |
| 문제명 | 두 수의 합 |
| 레벨 | 실버 3 |
| 시간복잡도 | O(n) |
| 인풋사이즈 | n<=1000000 |
| 사용한 언어 | Python |
| 제출기록 | 44876KB / 164ms |
| 최고기록 | 96ms |
| 해결날짜 | 2021/08/03 |
"""Solution code for "BOJ 3273. 두 수의 합".
- Problem link: https://www.acmicpc.net/problem/3273
- Solution link: http://www.teferi.net/ps/problems/boj/3273
"""
import collections
def main():
n = int(input()) # pylint: disable=unused-variable
a = [int(x) for x in input().split()]
x = int(input())
counter = collections.Counter(a)
answer = sum(c * counter[x - v] for v, c in counter.items() if v + v < x)
print(answer)
if __name__ == '__main__':
main()