結果

問題 No.723 2つの数の和
ユーザー shoooooshooooo
提出日時 2019-11-27 00:30:41
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 225 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 22,956 KB
最終ジャッジ日時 2023-08-06 21:57:24
合計ジャッジ時間 2,756 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,792 KB
testcase_01 AC 16 ms
7,964 KB
testcase_02 AC 15 ms
7,848 KB
testcase_03 AC 75 ms
17,820 KB
testcase_04 AC 98 ms
19,836 KB
testcase_05 AC 90 ms
18,560 KB
testcase_06 AC 92 ms
18,424 KB
testcase_07 AC 48 ms
14,132 KB
testcase_08 AC 53 ms
15,028 KB
testcase_09 AC 95 ms
19,192 KB
testcase_10 AC 47 ms
14,004 KB
testcase_11 AC 22 ms
9,548 KB
testcase_12 AC 58 ms
14,652 KB
testcase_13 AC 95 ms
19,704 KB
testcase_14 AC 33 ms
11,540 KB
testcase_15 AC 47 ms
14,336 KB
testcase_16 AC 64 ms
17,760 KB
testcase_17 AC 78 ms
17,832 KB
testcase_18 AC 60 ms
9,988 KB
testcase_19 AC 80 ms
19,716 KB
testcase_20 AC 15 ms
7,860 KB
testcase_21 AC 16 ms
7,916 KB
testcase_22 AC 16 ms
7,908 KB
testcase_23 AC 115 ms
22,956 KB
testcase_24 AC 38 ms
13,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,X=map(int,input().split())
a=list(map(int,input().split()))
cnt={}
ans=0
for i in range(N):
  if a[i] not in cnt:
    cnt[a[i]]=1
  else:
    cnt[a[i]]+=1
for i in cnt:
  if X-i in cnt:
    ans+=(cnt[i]*cnt[X-i])
print(ans)
0