結果
| 問題 |
No.16 累乗の加算
|
| コンテスト | |
| ユーザー |
alexara1123
|
| 提出日時 | 2019-09-23 00:56:19 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 633 bytes |
| コンパイル時間 | 210 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 88,968 KB |
| 最終ジャッジ日時 | 2024-09-19 03:50:18 |
| 合計ジャッジ時間 | 3,193 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 14 |
ソースコード
from fractions import gcd
from heapq import*
import math
from collections import defaultdict, Counter
import sys
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
inf = float("inf")
def main():
x, n = map(int, input().split())
a = list(map(int, input().split()))
def modpow(a, n, mod):
res = 1
while n > 0:
if n & 1:
res = res * a % mod
a = a * a % mod
n >>= 1
return res
ans = 0
for i in range(n):
print(modpow(x, a[i], 1000003))
ans += modpow(x, a[i], 1000003)
print(ans)
if __name__ == '__main__':
main()
alexara1123