結果

問題 No.723 2つの数の和
ユーザー B9syDOfYhHFXecu
提出日時 2018-10-31 10:30:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 373 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 82,128 KB
実行使用メモリ 86,784 KB
最終ジャッジ日時 2024-11-19 11:53:59
合計ジャッジ時間 3,272 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

n, X = [int(x) for x in input().split(' ')]
numbers = [int(x) for x in input().split(' ')]
numbers_count = {}
count = 0

for num in numbers:
    if num in numbers_count:
        numbers_count[num] += 1

    else:
        numbers_count[num] = 1

for i in numbers_count:
    if (X - i) in numbers_count:
        count += numbers_count[i] * numbers_count[X - i]

print(count)
0