結果
| 問題 | No.16 累乗の加算 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-01-11 10:23:09 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 572 bytes |
| 記録 | |
| コンパイル時間 | 536 ms |
| コンパイル使用メモリ | 20,828 KB |
| 実行使用メモリ | 22,140 KB |
| 最終ジャッジ日時 | 2026-05-29 16:47:20 |
| 合計ジャッジ時間 | 7,617 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 TLE * 1 -- * 11 |
ソースコード
def binary_exponent(x, exponent):
sum_values = 1
quotient = exponent
square_num = x
while quotient > 0:
quotient, mod = divmod(quotient, 2)
if mod == 1:
sum_values *= square_num
square_num = pow(square_num, 2)
return sum_values
if __name__ == '__main__':
xN = list(map(int, input().split()))
x = xN[0]
N = xN[1]
exponent_list = list(map(int, input().split()))
sum_values = 0
for exponent in exponent_list:
sum_values += binary_exponent(x, exponent)
print(sum_values % 1000003)