結果

問題 No.1343 Dividing Digit
ユーザー Ultimate_Tea_04Ultimate_Tea_04
提出日時 2021-01-17 21:46:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 10,540 KB
実行使用メモリ 19,312 KB
最終ジャッジ日時 2023-08-20 03:39:38
合計ジャッジ時間 2,796 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,812 KB
testcase_01 AC 15 ms
7,748 KB
testcase_02 AC 16 ms
7,764 KB
testcase_03 AC 111 ms
18,780 KB
testcase_04 AC 24 ms
9,064 KB
testcase_05 AC 39 ms
11,140 KB
testcase_06 AC 31 ms
10,000 KB
testcase_07 AC 51 ms
12,356 KB
testcase_08 AC 87 ms
16,520 KB
testcase_09 AC 94 ms
17,436 KB
testcase_10 AC 29 ms
9,712 KB
testcase_11 AC 48 ms
12,056 KB
testcase_12 AC 81 ms
16,124 KB
testcase_13 AC 74 ms
15,288 KB
testcase_14 AC 27 ms
9,344 KB
testcase_15 AC 44 ms
11,396 KB
testcase_16 AC 28 ms
9,672 KB
testcase_17 AC 92 ms
17,408 KB
testcase_18 AC 101 ms
18,588 KB
testcase_19 AC 78 ms
15,512 KB
testcase_20 AC 57 ms
13,068 KB
testcase_21 AC 92 ms
17,404 KB
testcase_22 AC 93 ms
17,008 KB
testcase_23 AC 107 ms
19,312 KB
testcase_24 AC 90 ms
9,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def powf(x,n):
    if n == 0:
        return 1
    k = 1
    while n>1:
        if n%2 != 0:
            k *= x
        x *= x
        n //= 2
    return k*x

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