結果

問題 No.723 2つの数の和
ユーザー sekihankamibanzsekihankamibanz
提出日時 2018-10-28 16:52:49
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 357 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 10,608 KB
実行使用メモリ 22,736 KB
最終ジャッジ日時 2023-08-12 08:05:27
合計ジャッジ時間 2,781 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,876 KB
testcase_01 AC 15 ms
7,796 KB
testcase_02 AC 17 ms
7,784 KB
testcase_03 AC 75 ms
17,612 KB
testcase_04 AC 96 ms
19,644 KB
testcase_05 AC 85 ms
18,504 KB
testcase_06 AC 98 ms
18,512 KB
testcase_07 AC 47 ms
13,976 KB
testcase_08 AC 52 ms
14,992 KB
testcase_09 AC 92 ms
19,052 KB
testcase_10 AC 45 ms
13,812 KB
testcase_11 AC 22 ms
9,300 KB
testcase_12 AC 57 ms
14,496 KB
testcase_13 AC 92 ms
19,492 KB
testcase_14 AC 33 ms
11,380 KB
testcase_15 AC 46 ms
14,200 KB
testcase_16 AC 64 ms
17,564 KB
testcase_17 AC 76 ms
17,468 KB
testcase_18 AC 54 ms
9,924 KB
testcase_19 AC 73 ms
19,604 KB
testcase_20 AC 15 ms
7,876 KB
testcase_21 AC 16 ms
7,824 KB
testcase_22 AC 15 ms
7,884 KB
testcase_23 AC 108 ms
22,736 KB
testcase_24 AC 36 ms
13,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


n, X = [int(x) for x in input().split(' ')]
nums = [int(x) for x in input().split(' ')]

nums_count = {}
count = 0

for i in nums:
    if i in nums_count:
        nums_count[i] += 1
    
    else:
        nums_count[i] = 1

for i in nums_count.keys():
    x = X - i
    
    if x in nums_count:
        count += nums_count[i] * nums_count[x]

print(count)
0