結果

問題 No.347 微分と積分
ユーザー airis
提出日時 2016-02-27 00:04:33
言語 Python2
(2.7.18)
結果
AC  
実行時間 12 ms / 5,000 ms
コード長 401 bytes
コンパイル時間 55 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-24 10:38:40
合計ジャッジ時間 1,116 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

EPS = 1e-9

N = input()
B = input()
a = map(float, raw_input().split())


def f(x):
  res = 0
  for i in xrange(len(a)):
    res += a[i] * (x**(a[i] - 1))
  return res

def F(x):
  res = 0
  for i in xrange(len(a)):
    if -1.0 - EPS <= a[i] and a[i] <= -1.0 + EPS:
      res += math.log(x)
    else:
      res += x ** (a[i] + 1) / (1.0 * (a[i] + 1))
  return res


print f(B)
print F(B)
0