結果

問題 No.2260 Adic Sum
コンテスト
ユーザー 👑 rin204
提出日時 2024-04-27 15:17:56
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 268 ms / 2,000 ms
+ 627µs
コード長 235 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 66 ms
コンパイル使用メモリ 81,620 KB
実行使用メモリ 227,556 KB
最終ジャッジ日時 2026-09-23 11:40:22
合計ジャッジ時間 6,190 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n, P = map(int, input().split())
A = list(map(int, input().split()))
x = P
ans = 0
while x < max(A):
    cnt = {}
    for a in A:
        b = a % x
        ans += cnt.get(b, 0)
        cnt[b] = cnt.get(b, 0) + 1
    x *= P

print(ans)
0