結果

問題 No.16 累乗の加算
ユーザー ryomacryomac
提出日時 2023-05-21 18:48:48
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 332 bytes
コンパイル時間 356 ms
コンパイル使用メモリ 87,220 KB
実行使用メモリ 84,468 KB
最終ジャッジ日時 2023-08-23 15:14:01
合計ジャッジ時間 4,012 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

x, N = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10**6 + 3

from functools import lru_cache


@lru_cache(maxsize=None)
def f(x, n):
    if n == 0:
        return 1
    if n == 1:
        return x
    else:
        return x * f(x, n - 1) % MOD


ans = 0
for a in A:
    ans += f(x, a) % MOD
print(ans % MOD)
0