結果
| 問題 | No.16 累乗の加算 |
| コンテスト | |
| ユーザー |
brthyyjp
|
| 提出日時 | 2020-09-02 08:34:40 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 43 ms / 5,000 ms |
| コード長 | 331 bytes |
| コンパイル時間 | 337 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 58,496 KB |
| 最終ジャッジ日時 | 2024-11-21 14:02:18 |
| 合計ジャッジ時間 | 1,564 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
ソースコード
x, n = map(int, input().split())
A = list(map(int, input().split()))
mod = 1000003
def power(a, n, mod):
bi=str(format(n,"b"))
res=1
for i in range(len(bi)):
res=(res*res) %mod
if bi[i]=="1":
res=(res*a) %mod
return res
ans = 0
for a in A:
ans += power(x, a, mod)
print(ans%mod)
brthyyjp