結果

問題 No.1343 Dividing Digit
ユーザー tktk_snsntktk_snsn
提出日時 2021-01-16 13:13:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 245 bytes
コンパイル時間 319 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 90,824 KB
最終ジャッジ日時 2023-08-18 09:23:02
合計ジャッジ時間 4,123 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,484 KB
testcase_01 AC 73 ms
71,108 KB
testcase_02 AC 74 ms
71,528 KB
testcase_03 AC 105 ms
90,776 KB
testcase_04 AC 81 ms
76,704 KB
testcase_05 AC 84 ms
78,604 KB
testcase_06 AC 82 ms
76,736 KB
testcase_07 AC 84 ms
80,664 KB
testcase_08 AC 91 ms
87,372 KB
testcase_09 AC 93 ms
88,872 KB
testcase_10 AC 80 ms
76,612 KB
testcase_11 AC 81 ms
80,004 KB
testcase_12 AC 89 ms
85,984 KB
testcase_13 AC 88 ms
84,612 KB
testcase_14 AC 77 ms
76,632 KB
testcase_15 AC 81 ms
79,492 KB
testcase_16 AC 80 ms
76,340 KB
testcase_17 AC 91 ms
88,828 KB
testcase_18 AC 96 ms
90,412 KB
testcase_19 AC 91 ms
84,492 KB
testcase_20 AC 87 ms
82,204 KB
testcase_21 AC 94 ms
87,140 KB
testcase_22 AC 93 ms
88,712 KB
testcase_23 AC 96 ms
90,824 KB
testcase_24 AC 95 ms
90,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
A = list(map(int, input().split()))
A.reverse()

mod = sum(A)
powk = [1] * N
for i in range(1, N):
    powk[i] = powk[i - 1] * K % mod

ans = 0
for a, k in zip(A, powk):
    ans += a * k
    ans %= mod
print(ans)
0