結果

問題 No.16 累乗の加算
ユーザー kutsutamakutsutama
提出日時 2018-03-11 01:31:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 528 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 14,720 KB
最終ジャッジ日時 2024-04-23 00:50:24
合計ジャッジ時間 7,942 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

x, n = [int(s) for s in input().split()]
a = [int(s) for s in input().split()]
mod = 1000003

big = 100000
xx = [0] * (big + 1)
xx[0] = 1
for e in range(1, big + 1):
    xx[e] = xx[e - 1] * x % mod
res = 0
for ai in a:
    if ai > big:
        prod = xx[big]
        for e in range(1, ai // big + 1):
            prod = prod * xx[big] % mod
        for e in range(1, ai % big + 1):
            prod = prod * x % mod
        res = (res + prod) % mod
    else:
        res = (res + xx[ai]) % mod

print(res)
0