結果

問題 No.1343 Dividing Digit
ユーザー H3PO4H3PO4
提出日時 2021-01-16 13:04:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 183 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 10,576 KB
実行使用メモリ 19,560 KB
最終ジャッジ日時 2023-08-18 09:07:30
合計ジャッジ時間 2,565 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,756 KB
testcase_01 AC 16 ms
7,804 KB
testcase_02 AC 16 ms
7,848 KB
testcase_03 AC 84 ms
18,688 KB
testcase_04 AC 22 ms
9,068 KB
testcase_05 AC 35 ms
11,076 KB
testcase_06 AC 28 ms
10,000 KB
testcase_07 AC 43 ms
12,320 KB
testcase_08 AC 76 ms
16,548 KB
testcase_09 AC 80 ms
17,488 KB
testcase_10 AC 25 ms
9,396 KB
testcase_11 AC 40 ms
11,572 KB
testcase_12 AC 65 ms
15,600 KB
testcase_13 AC 63 ms
15,256 KB
testcase_14 AC 25 ms
9,312 KB
testcase_15 AC 37 ms
11,356 KB
testcase_16 AC 26 ms
9,504 KB
testcase_17 AC 78 ms
17,404 KB
testcase_18 AC 84 ms
18,632 KB
testcase_19 AC 63 ms
15,152 KB
testcase_20 AC 49 ms
12,700 KB
testcase_21 AC 72 ms
16,964 KB
testcase_22 AC 77 ms
17,068 KB
testcase_23 AC 85 ms
19,560 KB
testcase_24 AC 71 ms
9,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
A = list(map(int, input().split()))
A.reverse()
S = sum(A)
res = 0
exp = 1
for a in A:
    res = (res + exp * a) % S
    exp = exp * K % S
print(res)
0