結果
| 問題 | No.16 累乗の加算 |
| コンテスト | |
| ユーザー |
maatanbeta
|
| 提出日時 | 2017-04-28 16:04:19 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 652 bytes |
| 記録 | |
| コンパイル時間 | 306 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-09-13 17:47:59 |
| 合計ジャッジ時間 | 1,277 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 WA * 11 |
ソースコード
from math import log10
x, N = map(int, input().split())
a = list(map(int, input().split()))
xp = 0
n = 1000003
def keta(x, a):
ketasuu = int(a * log10(x)) + 1
return ketasuu
def amari(x, a, n):
global xp
if keta(x, a) <= 9:
return (x ** a) % n
else:
result = 0
r = a // xp
result = amari(j, r, n) * (x ** (a % xp) % n) % n
return result
if x > 1:
i = 0
while(True):
if x ** i > n:
xp = i
j = (x ** i) % n
break
i += 1
shiguma = 0
for i in range(N):
shiguma += amari(x, a[i], n)
shiguma = shiguma % n
print(shiguma)
maatanbeta