結果

問題 No.1343 Dividing Digit
ユーザー brthyyjpbrthyyjp
提出日時 2021-01-22 01:17:07
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 92 ms / 2,000 ms
コード長 291 bytes
コンパイル時間 652 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 91,032 KB
最終ジャッジ日時 2023-08-26 16:40:22
合計ジャッジ時間 4,622 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
76,752 KB
testcase_01 AC 70 ms
76,644 KB
testcase_02 AC 71 ms
76,852 KB
testcase_03 AC 92 ms
90,912 KB
testcase_04 AC 75 ms
77,428 KB
testcase_05 AC 76 ms
79,236 KB
testcase_06 AC 76 ms
77,576 KB
testcase_07 AC 79 ms
81,004 KB
testcase_08 AC 87 ms
87,400 KB
testcase_09 AC 89 ms
88,968 KB
testcase_10 AC 75 ms
77,536 KB
testcase_11 AC 79 ms
80,652 KB
testcase_12 AC 84 ms
85,884 KB
testcase_13 AC 84 ms
85,000 KB
testcase_14 AC 75 ms
77,592 KB
testcase_15 AC 78 ms
79,812 KB
testcase_16 AC 75 ms
77,416 KB
testcase_17 AC 88 ms
89,000 KB
testcase_18 AC 92 ms
90,500 KB
testcase_19 AC 85 ms
84,824 KB
testcase_20 AC 81 ms
82,688 KB
testcase_21 AC 89 ms
87,492 KB
testcase_22 AC 89 ms
89,032 KB
testcase_23 AC 90 ms
91,032 KB
testcase_24 AC 88 ms
90,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

mod = sum(A)

table = [0]*(10**5+1)
table[0] = 1
for i in range(1, 10**5+1):
     table[i] = table[i-1]*k
     table[i] %= mod

ans = 0
for i, a in enumerate(A):
    ans += a*table[i]
    ans %= mod
print(ans)
0