結果

問題 No.723 2つの数の和
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2018-08-26 10:42:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 239 bytes
コンパイル時間 114 ms
コンパイル使用メモリ 10,532 KB
実行使用メモリ 22,204 KB
最終ジャッジ日時 2023-09-10 23:43:49
合計ジャッジ時間 3,184 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,940 KB
testcase_01 AC 16 ms
7,832 KB
testcase_02 AC 15 ms
7,772 KB
testcase_03 AC 71 ms
17,676 KB
testcase_04 AC 92 ms
18,860 KB
testcase_05 AC 80 ms
17,996 KB
testcase_06 AC 93 ms
18,520 KB
testcase_07 AC 44 ms
14,088 KB
testcase_08 AC 49 ms
14,968 KB
testcase_09 AC 93 ms
19,168 KB
testcase_10 AC 47 ms
13,852 KB
testcase_11 AC 22 ms
9,464 KB
testcase_12 AC 57 ms
14,660 KB
testcase_13 AC 91 ms
19,684 KB
testcase_14 AC 32 ms
11,448 KB
testcase_15 AC 43 ms
14,260 KB
testcase_16 AC 62 ms
17,592 KB
testcase_17 AC 74 ms
17,612 KB
testcase_18 AC 51 ms
9,916 KB
testcase_19 AC 70 ms
19,716 KB
testcase_20 AC 16 ms
7,788 KB
testcase_21 AC 16 ms
7,756 KB
testcase_22 AC 15 ms
7,804 KB
testcase_23 AC 109 ms
22,204 KB
testcase_24 AC 36 ms
13,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, X = map(int, input().split())
a = list(map(int, input().split()))

b = {}
for ai in a:
    if ai not in b:
        b[ai] = 1
    else:
        b[ai] += 1

ans = 0
for k in b:
    if X - k in b:
        ans += b[k] * b[X - k]

print(ans)
0