結果
| 問題 | 
                            No.16 累乗の加算
                             | 
                    
| コンテスト | |
| ユーザー | 
                             alexara1123
                         | 
                    
| 提出日時 | 2019-09-23 00:56:32 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 593 bytes | 
| コンパイル時間 | 151 ms | 
| コンパイル使用メモリ | 82,048 KB | 
| 実行使用メモリ | 88,832 KB | 
| 最終ジャッジ日時 | 2024-09-19 03:50:22 | 
| 合計ジャッジ時間 | 2,749 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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):
        ans += modpow(x, a[i], 1000003)
    print(ans)
if __name__ == '__main__':
    main()
            
            
            
        
            
alexara1123