結果
| 問題 |
No.2260 Adic Sum
|
| コンテスト | |
| ユーザー |
sotanishy
|
| 提出日時 | 2023-03-26 12:54:30 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 516 ms / 2,000 ms |
| コード長 | 302 bytes |
| コンパイル時間 | 350 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 200,296 KB |
| 最終ジャッジ日時 | 2024-10-06 06:51:39 |
| 合計ジャッジ時間 | 6,390 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 |
ソースコード
from collections import defaultdict
import sys
input = sys.stdin.readline
N, P = map(int, input().split())
A = list(map(int, input().split()))
p = P
ans = 0
while p <= 10**10:
cnt = defaultdict(int)
for x in A:
r = x % p
ans += cnt[r]
cnt[r] += 1
p *= P
print(ans)
sotanishy