結果

問題 No.723 2つの数の和
ユーザー 💕💖💞💕💖💞
提出日時 2018-08-04 12:52:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 247 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 11,784 KB
実行使用メモリ 30,340 KB
最終ジャッジ日時 2023-10-19 21:48:53
合計ジャッジ時間 2,969 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,116 KB
testcase_01 AC 30 ms
10,116 KB
testcase_02 AC 31 ms
10,116 KB
testcase_03 AC 100 ms
20,744 KB
testcase_04 AC 123 ms
22,584 KB
testcase_05 AC 106 ms
21,488 KB
testcase_06 AC 119 ms
21,528 KB
testcase_07 AC 66 ms
17,552 KB
testcase_08 AC 75 ms
18,028 KB
testcase_09 AC 120 ms
22,836 KB
testcase_10 AC 68 ms
17,264 KB
testcase_11 AC 38 ms
11,872 KB
testcase_12 AC 79 ms
18,596 KB
testcase_13 AC 110 ms
22,444 KB
testcase_14 AC 49 ms
15,556 KB
testcase_15 AC 67 ms
17,732 KB
testcase_16 AC 84 ms
20,644 KB
testcase_17 AC 100 ms
22,356 KB
testcase_18 AC 59 ms
11,908 KB
testcase_19 AC 80 ms
21,628 KB
testcase_20 AC 30 ms
10,116 KB
testcase_21 AC 30 ms
10,116 KB
testcase_22 AC 30 ms
10,116 KB
testcase_23 AC 139 ms
30,340 KB
testcase_24 AC 56 ms
17,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

N,X = [int(x) for x in input().split()]
xs = [int(x) for x in input().split()]

keys  = set(xs)
count = Counter(xs)

sum = 0
for key in list(keys):
  if X-key in keys:
    sum += count[key]*count[X-key]

print(sum)
0