結果

問題 No.16 累乗の加算
ユーザー kwnwsdnckwnwsdnc
提出日時 2018-04-24 20:21:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 323 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 10,684 KB
実行使用メモリ 25,840 KB
最終ジャッジ日時 2023-09-09 23:38:47
合計ジャッジ時間 7,117 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,772 KB
testcase_01 AC 16 ms
7,944 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

num=list(map(int,input().split()))
a=list(map(int,input().split()))
N=1000003
total=0
mod=1
n=num[0]
for i in range(num[1]):
    if mod*(n**a[i])>N:
        mod=(n**a[i])%N
        total+=mod
        if i!=num[1]-1:
            a[i+1]=a[i+1]-a[i]
    else:
        total+=n**a[i]
        mod=1
        
    
print(total%N)
0