結果

問題 No.723 2つの数の和
ユーザー shoooooshooooo
提出日時 2019-11-27 00:30:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 225 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 25,324 KB
最終ジャッジ日時 2024-04-24 16:24:54
合計ジャッジ時間 2,580 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,752 KB
testcase_01 AC 25 ms
10,752 KB
testcase_02 AC 25 ms
10,752 KB
testcase_03 AC 80 ms
19,448 KB
testcase_04 AC 99 ms
20,884 KB
testcase_05 AC 94 ms
21,008 KB
testcase_06 AC 95 ms
20,792 KB
testcase_07 AC 55 ms
16,428 KB
testcase_08 AC 59 ms
17,080 KB
testcase_09 AC 103 ms
20,896 KB
testcase_10 AC 55 ms
16,352 KB
testcase_11 AC 32 ms
12,032 KB
testcase_12 AC 67 ms
16,596 KB
testcase_13 AC 101 ms
20,652 KB
testcase_14 AC 41 ms
13,824 KB
testcase_15 AC 53 ms
16,332 KB
testcase_16 AC 71 ms
19,340 KB
testcase_17 AC 83 ms
20,700 KB
testcase_18 AC 68 ms
12,488 KB
testcase_19 AC 86 ms
20,844 KB
testcase_20 AC 25 ms
10,752 KB
testcase_21 AC 26 ms
10,880 KB
testcase_22 AC 25 ms
10,624 KB
testcase_23 AC 126 ms
25,324 KB
testcase_24 AC 46 ms
15,420 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