結果
| 問題 | No.16 累乗の加算 |
| コンテスト | |
| ユーザー |
HIROPON87069639
|
| 提出日時 | 2016-02-21 23:39:01 |
| 言語 | PyPy2 (7.3.20) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 439 bytes |
| 記録 | |
| コンパイル時間 | 135 ms |
| コンパイル使用メモリ | 77,748 KB |
| 最終ジャッジ日時 | 2025-12-03 19:27:50 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 TLE * 1 -- * 11 |
ソースコード
# -*- coding: utf-8 -*-
def calc(x, n):
flag = 1
if n == 0:
return 1
p = 1
while flag == 1:
nn = n // 2
mm = n % 2
p *= x ** mm
if nn == 0:
flag = 0
else:
x *= x
n = nn
return p % 1000003
x, N = map(int, raw_input().split())
n = map(int, raw_input().split())
tot = 0
for i in range(0, N):
tot += calc(x, n[i]) % 1000003
print tot
HIROPON87069639