結果

問題 No.723 2つの数の和
ユーザー santafe1006santafe1006
提出日時 2018-11-23 21:08:13
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 227 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 10,632 KB
実行使用メモリ 22,932 KB
最終ジャッジ日時 2023-08-26 04:40:20
合計ジャッジ時間 3,309 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,796 KB
testcase_01 AC 16 ms
7,776 KB
testcase_02 AC 15 ms
7,740 KB
testcase_03 AC 75 ms
17,764 KB
testcase_04 AC 90 ms
19,688 KB
testcase_05 AC 79 ms
17,972 KB
testcase_06 AC 86 ms
18,464 KB
testcase_07 AC 44 ms
14,116 KB
testcase_08 AC 49 ms
14,960 KB
testcase_09 AC 90 ms
19,048 KB
testcase_10 AC 44 ms
13,900 KB
testcase_11 AC 21 ms
9,400 KB
testcase_12 AC 54 ms
14,492 KB
testcase_13 AC 85 ms
19,644 KB
testcase_14 AC 31 ms
11,500 KB
testcase_15 AC 44 ms
14,304 KB
testcase_16 AC 60 ms
17,576 KB
testcase_17 AC 75 ms
17,792 KB
testcase_18 AC 52 ms
10,048 KB
testcase_19 AC 70 ms
19,680 KB
testcase_20 AC 15 ms
7,832 KB
testcase_21 AC 15 ms
7,840 KB
testcase_22 AC 15 ms
7,788 KB
testcase_23 AC 108 ms
22,932 KB
testcase_24 AC 35 ms
13,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

for j in a :
    if x - j in a :
        k += a[j]*a[x-j]

print(k)
0