結果

問題 No.723 2つの数の和
ユーザー akitsugu777akitsugu777
提出日時 2018-10-05 14:49:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 278 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 25,340 KB
最終ジャッジ日時 2024-04-20 16:44:13
合計ジャッジ時間 2,945 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 30 ms
10,880 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 94 ms
19,460 KB
testcase_04 AC 121 ms
20,848 KB
testcase_05 AC 106 ms
20,960 KB
testcase_06 AC 114 ms
21,088 KB
testcase_07 AC 65 ms
16,184 KB
testcase_08 AC 70 ms
16,880 KB
testcase_09 AC 116 ms
20,344 KB
testcase_10 AC 65 ms
16,180 KB
testcase_11 AC 37 ms
11,904 KB
testcase_12 AC 73 ms
16,588 KB
testcase_13 AC 113 ms
20,532 KB
testcase_14 AC 49 ms
13,948 KB
testcase_15 AC 63 ms
16,596 KB
testcase_16 AC 82 ms
19,352 KB
testcase_17 AC 97 ms
20,844 KB
testcase_18 AC 78 ms
12,496 KB
testcase_19 AC 99 ms
20,724 KB
testcase_20 AC 30 ms
10,752 KB
testcase_21 AC 30 ms
10,752 KB
testcase_22 AC 30 ms
10,752 KB
testcase_23 AC 140 ms
25,340 KB
testcase_24 AC 54 ms
15,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, x = [int(_) for _ in input().split()]
l = [int(_) for _ in input().split()]

count = {}
for i in l:
    if i in count:
        count[i] += 1
    else:
        count[i] = 1

answer = 0
for i in count:
    if x-i in count:
        answer += count[i] * count[x-i]

print(answer)
0