結果

問題 No.2260 Adic Sum
ユーザー okapin
提出日時 2023-04-07 21:54:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 420 ms / 2,000 ms
コード長 282 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 82,300 KB
実行使用メモリ 179,072 KB
最終ジャッジ日時 2024-10-06 07:15:53
合計ジャッジ時間 5,429 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
n, p = map(int, input().split())
a = list(map(int, input().split()))
x = p
res = 0
while max(a) > x:
    d = defaultdict(int)
    for i in range(n):
        d[a[i] % x] += 1
    for v in d.values():
        res += v*(v-1)//2
    x *= p
print(res)
0