結果
| 問題 | 
                            No.16 累乗の加算
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2018-04-13 22:42:16 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 451 bytes | 
| コンパイル時間 | 179 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-06-26 21:48:08 | 
| 合計ジャッジ時間 | 1,284 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 13 WA * 1 | 
ソースコード
def exps_input(exps):
    return [int(e) for e in exps.split(' ')]
mod = 1_000_003
def pow_2(x, y):
    K = 1
    while y > 1:
        if y % 2 == 0:
            x = x ** 2 % mod
            y = y // 2
        else:
            K = K * x % mod
            x = x ** 2 % mod
            y = (y - 1) // 2
    return K * x % mod
sum = 0
base = int(input().split(' ')[0])
for exp in exps_input(input()):
    sum += pow_2(base, exp)
print(sum % mod)