結果

問題 No.1343 Dividing Digit
ユーザー KudeKude
提出日時 2021-01-16 16:13:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 181 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 79,360 KB
最終ジャッジ日時 2024-05-05 19:04:54
合計ジャッジ時間 2,237 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
51,712 KB
testcase_01 AC 36 ms
51,456 KB
testcase_02 AC 38 ms
51,456 KB
testcase_03 AC 65 ms
78,976 KB
testcase_04 AC 49 ms
60,800 KB
testcase_05 AC 45 ms
64,512 KB
testcase_06 AC 42 ms
62,208 KB
testcase_07 AC 48 ms
66,432 KB
testcase_08 AC 55 ms
74,880 KB
testcase_09 AC 61 ms
76,800 KB
testcase_10 AC 42 ms
61,312 KB
testcase_11 AC 47 ms
65,664 KB
testcase_12 AC 54 ms
72,960 KB
testcase_13 AC 54 ms
71,680 KB
testcase_14 AC 44 ms
61,184 KB
testcase_15 AC 47 ms
65,024 KB
testcase_16 AC 44 ms
61,824 KB
testcase_17 AC 57 ms
76,672 KB
testcase_18 AC 60 ms
78,720 KB
testcase_19 AC 53 ms
71,424 KB
testcase_20 AC 49 ms
68,608 KB
testcase_21 AC 58 ms
75,136 KB
testcase_22 AC 62 ms
76,416 KB
testcase_23 AC 61 ms
79,360 KB
testcase_24 AC 56 ms
77,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = sum(a)
t = 1
ans = 0
for ai in reversed(a):
    ans = (ans + ai * t) % mod
    t = t * k % mod
print(ans)
0