結果

問題 No.723 2つの数の和
ユーザー uran110uran110
提出日時 2018-11-16 20:12:27
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 226 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 10,512 KB
実行使用メモリ 22,736 KB
最終ジャッジ日時 2023-08-26 01:30:03
合計ジャッジ時間 2,451 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,784 KB
testcase_01 AC 14 ms
7,784 KB
testcase_02 AC 13 ms
7,920 KB
testcase_03 AC 63 ms
17,624 KB
testcase_04 AC 73 ms
19,776 KB
testcase_05 AC 71 ms
17,984 KB
testcase_06 AC 73 ms
18,480 KB
testcase_07 AC 38 ms
14,016 KB
testcase_08 AC 41 ms
14,984 KB
testcase_09 AC 75 ms
19,004 KB
testcase_10 AC 40 ms
13,772 KB
testcase_11 AC 18 ms
9,464 KB
testcase_12 AC 47 ms
14,468 KB
testcase_13 AC 74 ms
19,492 KB
testcase_14 AC 28 ms
11,516 KB
testcase_15 AC 38 ms
14,216 KB
testcase_16 AC 49 ms
17,472 KB
testcase_17 AC 62 ms
17,748 KB
testcase_18 AC 46 ms
9,928 KB
testcase_19 AC 59 ms
19,680 KB
testcase_20 AC 13 ms
7,760 KB
testcase_21 AC 13 ms
7,856 KB
testcase_22 AC 14 ms
7,756 KB
testcase_23 AC 99 ms
22,736 KB
testcase_24 AC 33 ms
13,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ans=0
cnt={}
N,X=map(int,input().split())
a=list(map(int,input().split()))

for i in a:
    if i in cnt:
        cnt[i]+=1
    else:
        cnt[i]=1

for i in cnt:
    if (X-i) in cnt:
        ans+=cnt[i]*cnt[X-i]

print(ans)
0