結果

問題 No.723 2つの数の和
ユーザー akitsugu777akitsugu777
提出日時 2019-07-12 13:43:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 226 bytes
コンパイル時間 125 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 25,460 KB
最終ジャッジ日時 2024-04-28 17:28:20
合計ジャッジ時間 2,847 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,624 KB
testcase_01 AC 30 ms
10,624 KB
testcase_02 AC 32 ms
10,624 KB
testcase_03 AC 95 ms
19,204 KB
testcase_04 AC 123 ms
20,716 KB
testcase_05 AC 100 ms
21,116 KB
testcase_06 AC 104 ms
20,792 KB
testcase_07 AC 60 ms
16,304 KB
testcase_08 AC 66 ms
16,876 KB
testcase_09 AC 108 ms
20,344 KB
testcase_10 AC 61 ms
16,172 KB
testcase_11 AC 36 ms
12,032 KB
testcase_12 AC 71 ms
16,452 KB
testcase_13 AC 106 ms
20,528 KB
testcase_14 AC 47 ms
13,816 KB
testcase_15 AC 60 ms
16,460 KB
testcase_16 AC 77 ms
19,324 KB
testcase_17 AC 95 ms
20,780 KB
testcase_18 AC 72 ms
12,616 KB
testcase_19 AC 91 ms
20,844 KB
testcase_20 AC 30 ms
10,496 KB
testcase_21 AC 30 ms
10,624 KB
testcase_22 AC 29 ms
10,624 KB
testcase_23 AC 134 ms
25,460 KB
testcase_24 AC 51 ms
15,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, x = map(int, input().split())
a = list(map(int, input().split()))

d = {}
for i in a:
    if not i in d:
        d[i] = 1
    else:
        d[i] += 1

c = 0
for i in d:
    if x - i in d:
        c += d[i] * d[x-i]
print(c)
0