結果

問題 No.723 2つの数の和
ユーザー masumasumath1masumasumath1
提出日時 2020-01-08 21:06:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 215 bytes
コンパイル時間 362 ms
コンパイル使用メモリ 10,560 KB
実行使用メモリ 19,768 KB
最終ジャッジ日時 2023-08-15 00:45:17
合計ジャッジ時間 2,829 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,760 KB
testcase_01 AC 16 ms
7,868 KB
testcase_02 AC 16 ms
7,800 KB
testcase_03 AC 70 ms
15,628 KB
testcase_04 AC 101 ms
18,824 KB
testcase_05 AC 85 ms
17,600 KB
testcase_06 AC 85 ms
17,796 KB
testcase_07 AC 47 ms
13,124 KB
testcase_08 AC 52 ms
13,244 KB
testcase_09 AC 81 ms
19,040 KB
testcase_10 AC 54 ms
12,900 KB
testcase_11 AC 27 ms
9,856 KB
testcase_12 AC 54 ms
14,024 KB
testcase_13 AC 89 ms
19,628 KB
testcase_14 AC 37 ms
11,408 KB
testcase_15 AC 50 ms
13,264 KB
testcase_16 AC 63 ms
15,008 KB
testcase_17 AC 77 ms
17,460 KB
testcase_18 AC 85 ms
10,044 KB
testcase_19 AC 109 ms
19,768 KB
testcase_20 AC 15 ms
7,816 KB
testcase_21 AC 16 ms
7,756 KB
testcase_22 AC 16 ms
7,816 KB
testcase_23 AC 105 ms
19,608 KB
testcase_24 AC 41 ms
11,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, X = map(int,input().split())
A = list(map(int,input().split()))
cnt = [0 for _ in range(max(A)+1)]
ans = 0
for a in A:cnt[a] += 1
for a in A:
    if X-a >= 0 and X-a < len(cnt):
        ans += cnt[X-a]
print(ans)
0