結果

問題 No.1343 Dividing Digit
ユーザー nasubi24nasubi24
提出日時 2021-01-16 14:07:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 178 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 20,540 KB
最終ジャッジ日時 2024-05-05 16:18:24
合計ジャッジ時間 3,325 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,752 KB
testcase_01 AC 27 ms
10,624 KB
testcase_02 AC 26 ms
10,624 KB
testcase_03 AC 111 ms
20,060 KB
testcase_04 AC 34 ms
11,520 KB
testcase_05 AC 49 ms
13,440 KB
testcase_06 AC 42 ms
12,160 KB
testcase_07 AC 60 ms
14,560 KB
testcase_08 AC 100 ms
18,196 KB
testcase_09 AC 104 ms
19,044 KB
testcase_10 AC 40 ms
12,032 KB
testcase_11 AC 58 ms
13,824 KB
testcase_12 AC 86 ms
17,244 KB
testcase_13 AC 81 ms
16,860 KB
testcase_14 AC 37 ms
11,904 KB
testcase_15 AC 55 ms
13,568 KB
testcase_16 AC 39 ms
12,032 KB
testcase_17 AC 102 ms
18,948 KB
testcase_18 AC 109 ms
19,980 KB
testcase_19 AC 87 ms
17,056 KB
testcase_20 AC 67 ms
14,928 KB
testcase_21 AC 103 ms
18,344 KB
testcase_22 AC 102 ms
18,516 KB
testcase_23 AC 118 ms
20,540 KB
testcase_24 AC 101 ms
12,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
a=list(map(int,input().split()))
mod=sum(a)
ans=0
num=1
for i in range(n-1,-1,-1):
    ans+=num*a[i]
    ans%=mod
    num*=k
    num%=mod
print(ans)
0