結果

問題 No.2260 Adic Sum
ユーザー karinohito
提出日時 2023-03-20 01:26:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 509 ms / 2,000 ms
コード長 245 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 179,080 KB
最終ジャッジ日時 2024-10-06 06:52:56
合計ジャッジ時間 6,378 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N,P=map(int,input().split())
A = list(map(int,input().split()))
an=0
p=P
while p<10**9+3:
    M=defaultdict(int)
    for i in range(N):
        an=an+M[A[i]%p]
        M[A[i]%p]=M[A[i]%p]+1
    p=p*P
print(an)
0