結果

問題 No.2260 Adic Sum
ユーザー tassei903tassei903
提出日時 2023-04-07 21:37:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 488 ms / 2,000 ms
コード長 558 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 82,528 KB
実行使用メモリ 190,696 KB
最終ジャッジ日時 2024-04-15 23:47:44
合計ジャッジ時間 6,829 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
53,980 KB
testcase_01 AC 45 ms
54,192 KB
testcase_02 AC 45 ms
54,028 KB
testcase_03 AC 46 ms
54,508 KB
testcase_04 AC 45 ms
53,980 KB
testcase_05 AC 44 ms
55,484 KB
testcase_06 AC 44 ms
54,104 KB
testcase_07 AC 45 ms
54,024 KB
testcase_08 AC 56 ms
64,348 KB
testcase_09 AC 52 ms
62,032 KB
testcase_10 AC 56 ms
64,980 KB
testcase_11 AC 45 ms
54,604 KB
testcase_12 AC 57 ms
64,996 KB
testcase_13 AC 53 ms
63,548 KB
testcase_14 AC 72 ms
79,280 KB
testcase_15 AC 80 ms
86,560 KB
testcase_16 AC 67 ms
76,564 KB
testcase_17 AC 81 ms
89,904 KB
testcase_18 AC 323 ms
165,972 KB
testcase_19 AC 334 ms
172,760 KB
testcase_20 AC 256 ms
151,520 KB
testcase_21 AC 255 ms
151,920 KB
testcase_22 AC 232 ms
150,612 KB
testcase_23 AC 179 ms
118,296 KB
testcase_24 AC 333 ms
174,212 KB
testcase_25 AC 99 ms
104,096 KB
testcase_26 AC 97 ms
100,544 KB
testcase_27 AC 102 ms
104,588 KB
testcase_28 AC 98 ms
104,132 KB
testcase_29 AC 101 ms
103,792 KB
testcase_30 AC 108 ms
92,420 KB
testcase_31 AC 250 ms
93,472 KB
testcase_32 AC 246 ms
93,864 KB
testcase_33 AC 111 ms
93,104 KB
testcase_34 AC 184 ms
143,100 KB
testcase_35 AC 488 ms
190,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
from collections import Counter

n,p = na()

a = na()

x = p
ans = 0
while x <= 10**9:
    b = Counter([a[i] % x for i in range(n)])
    for i in b:
        ans += b[i] * (b[i]-1)//2
    x *= p
print(ans)
0