結果

問題 No.723 2つの数の和
ユーザー nonokai10nonokai10
提出日時 2018-09-30 14:58:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 241 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 24,572 KB
最終ジャッジ日時 2024-04-20 13:37:47
合計ジャッジ時間 3,086 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 92 ms
19,588 KB
testcase_04 AC 119 ms
20,116 KB
testcase_05 AC 110 ms
20,404 KB
testcase_06 AC 110 ms
20,872 KB
testcase_07 AC 62 ms
16,308 KB
testcase_08 AC 67 ms
17,084 KB
testcase_09 AC 113 ms
20,476 KB
testcase_10 AC 64 ms
16,080 KB
testcase_11 AC 37 ms
12,032 KB
testcase_12 AC 73 ms
16,588 KB
testcase_13 AC 112 ms
20,660 KB
testcase_14 AC 48 ms
13,696 KB
testcase_15 AC 62 ms
16,468 KB
testcase_16 AC 79 ms
19,480 KB
testcase_17 AC 96 ms
20,088 KB
testcase_18 AC 74 ms
12,620 KB
testcase_19 AC 95 ms
20,852 KB
testcase_20 AC 31 ms
10,880 KB
testcase_21 AC 31 ms
10,624 KB
testcase_22 AC 31 ms
10,880 KB
testcase_23 AC 136 ms
24,572 KB
testcase_24 AC 53 ms
15,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, x = map(int, input().split())
a = list(map(int, input().split()))
cnt = {}
for i in a:
    if i in cnt:
        cnt[i] += 1
    else:
        cnt[i] = 1

ans = 0

for i in cnt:
    if x-i in cnt:
        ans += cnt[i]*cnt[x-i]

print(ans)
0