結果
| 問題 | No.16 累乗の加算 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-10 17:01:10 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL) |
| 結果 |
WJ
不安定
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 352 bytes |
| 記録 | |
| 最終ジャッジ日時 | 2026-10-10 05:57:50 |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge5_0 |
(要ログイン)
ソースコード
x, N = map(int, input().split())
A = list(map(int, input().split()))
MOD = 1000003
def calc(base, exp, mod):
res = 1
while exp > 0:
if exp % 2 == 1:
res = (res * base) % mod
base = (base * base) % mod
exp //= 2
return res
ans = 0
for a in A:
temp = calc(x, a, MOD)
ans += temp
print(ans % MOD)