結果

問題 No.1343 Dividing Digit
ユーザー vwxyzvwxyz
提出日時 2022-09-06 17:36:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 287 ms / 2,000 ms
コード長 219 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 19,952 KB
最終ジャッジ日時 2024-05-01 13:46:48
合計ジャッジ時間 5,065 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,624 KB
testcase_01 AC 26 ms
10,624 KB
testcase_02 AC 28 ms
10,624 KB
testcase_03 AC 280 ms
19,432 KB
testcase_04 AC 45 ms
11,392 KB
testcase_05 AC 87 ms
13,096 KB
testcase_06 AC 63 ms
12,160 KB
testcase_07 AC 114 ms
14,064 KB
testcase_08 AC 221 ms
18,020 KB
testcase_09 AC 243 ms
18,348 KB
testcase_10 AC 56 ms
11,776 KB
testcase_11 AC 106 ms
13,676 KB
testcase_12 AC 197 ms
17,204 KB
testcase_13 AC 180 ms
16,788 KB
testcase_14 AC 52 ms
11,776 KB
testcase_15 AC 100 ms
13,440 KB
testcase_16 AC 56 ms
11,776 KB
testcase_17 AC 236 ms
18,312 KB
testcase_18 AC 272 ms
19,092 KB
testcase_19 AC 183 ms
16,672 KB
testcase_20 AC 140 ms
14,720 KB
testcase_21 AC 238 ms
18,256 KB
testcase_22 AC 230 ms
18,436 KB
testcase_23 AC 287 ms
19,952 KB
testcase_24 AC 224 ms
12,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline
write=sys.stdout.write

N,K=map(int,readline().split())
A=list(map(int,readline().split()))[::-1]
S=sum(A)
ans=0
for n in range(N):
    ans+=A[n]*pow(K,n,S)%S
    ans%=S
print(ans)
0