結果
| 問題 | No.16 累乗の加算 |
| コンテスト | |
| ユーザー |
(ΦωΦ)
|
| 提出日時 | 2015-04-15 21:27:34 |
| 言語 | PyPy2 (7.3.20) |
| 結果 |
AC
|
| 実行時間 | 82 ms / 5,000 ms |
| コード長 | 336 bytes |
| 記録 | |
| コンパイル時間 | 175 ms |
| コンパイル使用メモリ | 77,596 KB |
| 最終ジャッジ日時 | 2025-12-03 14:39:17 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
ソースコード
#!/usr/bin/python
def mod_pow(a, n, m):
res = 1
while n > 0:
if n & 1:
res = (res * a) % m
a = (a * a) % m
n >>= 1
return res
MOD = 1000003
x, _ = map(int, raw_input().split())
a = map(int, raw_input().split())
res = 0
for ele in a:
res = (res + mod_pow(x, ele, MOD)) % MOD
print res
(ΦωΦ)