結果

問題 No.1343 Dividing Digit
ユーザー shakayamishakayami
提出日時 2021-01-16 13:33:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 173 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 84,588 KB
最終ジャッジ日時 2023-08-18 10:02:54
合計ジャッジ時間 4,255 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,400 KB
testcase_01 AC 75 ms
71,312 KB
testcase_02 AC 75 ms
71,216 KB
testcase_03 AC 94 ms
84,264 KB
testcase_04 AC 81 ms
76,560 KB
testcase_05 AC 84 ms
77,732 KB
testcase_06 AC 81 ms
76,624 KB
testcase_07 AC 84 ms
78,896 KB
testcase_08 AC 90 ms
82,736 KB
testcase_09 AC 89 ms
83,208 KB
testcase_10 AC 81 ms
76,296 KB
testcase_11 AC 84 ms
78,428 KB
testcase_12 AC 89 ms
81,536 KB
testcase_13 AC 86 ms
81,036 KB
testcase_14 AC 80 ms
76,264 KB
testcase_15 AC 82 ms
77,924 KB
testcase_16 AC 80 ms
76,348 KB
testcase_17 AC 90 ms
83,236 KB
testcase_18 AC 91 ms
84,424 KB
testcase_19 AC 86 ms
80,840 KB
testcase_20 AC 85 ms
79,928 KB
testcase_21 AC 91 ms
82,556 KB
testcase_22 AC 93 ms
83,148 KB
testcase_23 AC 93 ms
84,588 KB
testcase_24 AC 90 ms
83,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
A=[int(i) for i in input().split()]
S=sum(A)
ans=0
tmp=1
for i in range(N)[::-1]:
    ans+=tmp*A[i]
    tmp*=K
    tmp%=S
    ans%=S
print(ans)
0