結果

問題 No.723 2つの数の和
ユーザー ye110wye110w
提出日時 2019-06-03 12:44:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 358 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 11,780 KB
実行使用メモリ 24,904 KB
最終ジャッジ日時 2023-10-17 23:17:51
合計ジャッジ時間 2,974 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,112 KB
testcase_01 AC 30 ms
10,112 KB
testcase_02 AC 30 ms
10,112 KB
testcase_03 AC 88 ms
18,620 KB
testcase_04 AC 116 ms
21,448 KB
testcase_05 AC 105 ms
19,656 KB
testcase_06 AC 109 ms
19,792 KB
testcase_07 AC 61 ms
15,020 KB
testcase_08 AC 65 ms
15,972 KB
testcase_09 AC 110 ms
21,728 KB
testcase_10 AC 59 ms
14,996 KB
testcase_11 AC 35 ms
11,352 KB
testcase_12 AC 73 ms
16,540 KB
testcase_13 AC 114 ms
21,548 KB
testcase_14 AC 46 ms
13,528 KB
testcase_15 AC 60 ms
15,200 KB
testcase_16 AC 79 ms
18,588 KB
testcase_17 AC 93 ms
20,440 KB
testcase_18 AC 103 ms
11,904 KB
testcase_19 AC 126 ms
21,624 KB
testcase_20 AC 29 ms
10,112 KB
testcase_21 AC 29 ms
10,112 KB
testcase_22 AC 28 ms
10,112 KB
testcase_23 AC 118 ms
24,904 KB
testcase_24 AC 51 ms
14,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

number_count = {}
for a in a_list:
    if a in number_count:
        number_count[a] = number_count[a] + 1
    else:
        number_count[a] = 1

count = 0
for a in a_list:
    j = x - a
    if j not in number_count:
        continue
    count = count + number_count[j]

print(count)
0