結果
| 問題 | No.16 累乗の加算 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-04-13 22:06:13 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 401 bytes |
| 記録 | |
| コンパイル時間 | 437 ms |
| コンパイル使用メモリ | 20,824 KB |
| 実行使用メモリ | 48,904 KB |
| 最終ジャッジ日時 | 2026-03-13 18:20:32 |
| 合計ジャッジ時間 | 67,867 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 TLE * 11 |
コンパイルメッセージ
Main.py:8: SyntaxWarning: "is" with 'int' literal. Did you mean "=="? if n is 0: Main.py:10: SyntaxWarning: "is" with 'int' literal. Did you mean "=="? if n % 2 is 0:
ソースコード
def exps_input(exps):
return [int(e) for e in exps.split(' ')]
def pow_2(x, n):
if n < 0:
return pow(1 / x, -n)
if n is 0:
return 1
if n % 2 is 0:
return pow_2(x ** 2, n // 2)
else:
return x * pow_2(x, n - 1)
sum = 0
mod = 1_000_003
base = int(input().split(' ')[0])
for exp in exps_input(input()):
sum += pow_2(base, exp)
print(sum % mod)