結果

問題 No.347 微分と積分
ユーザー lam6er
提出日時 2025-03-20 21:04:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 41 ms / 5,000 ms
コード長 533 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 82,404 KB
実行使用メモリ 53,872 KB
最終ジャッジ日時 2025-03-20 21:04:15
合計ジャッジ時間 2,039 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

n = int(input())
B = float(input())
a_list = list(map(float, input().split()))

derivative_sum = 0.0
integral_sum = 0.0

for a in a_list:
    # Calculate derivative term
    derivative_term = a * (B ** (a - 1))
    derivative_sum += derivative_term
    
    # Calculate integral term
    if a == -1.0:
        integral_term = math.log(B)
    else:
        integral_term = (B ** (a + 1)) / (a + 1)
    integral_sum += integral_term

# Output the results with sufficient precision
print(derivative_sum)
print(integral_sum)
0