結果

問題 No.16 累乗の加算
ユーザー こるこる
提出日時 2017-01-07 16:13:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 387 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 813,408 KB
最終ジャッジ日時 2024-05-09 22:04:17
合計ジャッジ時間 11,784 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

x,n=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
sum=0
dp=[-1]*100000001

def p(x,n):
    if dp[n]!=-1: return dp[n]
    if n<2:
        dp[n]=(x**n)
        return dp[n]
    if n%2!=0:
        dp[n]=(p(x,n-1)*x)
        return dp[n]
    if n%2==0:
        dp[n]=(p(x,int(n/2))**2)
        return dp[n]

for i in range(n):
    sum+=p(x,a[i])
print(sum%100000003)
0