結果

問題 No.1343 Dividing Digit
ユーザー lloyzlloyz
提出日時 2022-11-14 00:09:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 257 ms / 2,000 ms
コード長 183 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 10,632 KB
実行使用メモリ 19,656 KB
最終ジャッジ日時 2023-10-13 08:18:56
合計ジャッジ時間 4,875 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,792 KB
testcase_01 AC 15 ms
7,856 KB
testcase_02 AC 15 ms
7,848 KB
testcase_03 AC 246 ms
18,740 KB
testcase_04 AC 35 ms
9,176 KB
testcase_05 AC 75 ms
10,940 KB
testcase_06 AC 51 ms
9,884 KB
testcase_07 AC 100 ms
12,248 KB
testcase_08 AC 199 ms
16,600 KB
testcase_09 AC 219 ms
17,336 KB
testcase_10 AC 44 ms
9,416 KB
testcase_11 AC 93 ms
11,448 KB
testcase_12 AC 176 ms
15,708 KB
testcase_13 AC 164 ms
15,188 KB
testcase_14 AC 41 ms
9,292 KB
testcase_15 AC 84 ms
11,336 KB
testcase_16 AC 44 ms
9,388 KB
testcase_17 AC 218 ms
17,432 KB
testcase_18 AC 248 ms
18,756 KB
testcase_19 AC 166 ms
15,088 KB
testcase_20 AC 118 ms
12,780 KB
testcase_21 AC 213 ms
16,976 KB
testcase_22 AC 215 ms
16,920 KB
testcase_23 AC 257 ms
19,656 KB
testcase_24 AC 195 ms
9,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
A = list(map(int, input().split()))

mod = sum(A)
ans = 0
for i in range(n):
    ans += A[i] * pow(k, n - i - 1, mod) % mod
    ans %= mod
print(ans)
0