結果

問題 No.2260 Adic Sum
ユーザー KudeKude
提出日時 2023-04-07 21:25:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 466 ms / 2,000 ms
コード長 259 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 179,204 KB
最終ジャッジ日時 2024-04-15 23:38:09
合計ジャッジ時間 6,026 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
53,888 KB
testcase_01 AC 45 ms
53,376 KB
testcase_02 AC 45 ms
53,376 KB
testcase_03 AC 45 ms
53,352 KB
testcase_04 AC 44 ms
53,632 KB
testcase_05 AC 45 ms
53,504 KB
testcase_06 AC 44 ms
53,888 KB
testcase_07 AC 43 ms
53,504 KB
testcase_08 AC 54 ms
62,464 KB
testcase_09 AC 47 ms
53,888 KB
testcase_10 AC 52 ms
61,568 KB
testcase_11 AC 45 ms
53,760 KB
testcase_12 AC 58 ms
64,384 KB
testcase_13 AC 53 ms
62,592 KB
testcase_14 AC 72 ms
79,488 KB
testcase_15 AC 79 ms
87,040 KB
testcase_16 AC 65 ms
75,136 KB
testcase_17 AC 83 ms
88,448 KB
testcase_18 AC 287 ms
154,500 KB
testcase_19 AC 315 ms
163,796 KB
testcase_20 AC 231 ms
142,828 KB
testcase_21 AC 241 ms
142,588 KB
testcase_22 AC 215 ms
144,540 KB
testcase_23 AC 170 ms
114,324 KB
testcase_24 AC 309 ms
162,268 KB
testcase_25 AC 106 ms
102,068 KB
testcase_26 AC 104 ms
101,720 KB
testcase_27 AC 106 ms
102,016 KB
testcase_28 AC 105 ms
103,168 KB
testcase_29 AC 106 ms
101,880 KB
testcase_30 AC 110 ms
91,008 KB
testcase_31 AC 238 ms
91,072 KB
testcase_32 AC 242 ms
91,008 KB
testcase_33 AC 105 ms
92,200 KB
testcase_34 AC 140 ms
109,420 KB
testcase_35 AC 466 ms
179,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
n, p = map(int, input().split())
a = list(map(int, input().split()))
amx = max(a)
pk = p
ans = 0
while pk <= amx:
    c = Counter()
    for x in a:
        r = x % pk
        ans += c[r]
        c[r] += 1
    pk *= p
print(ans)
0