結果

問題 No.347 微分と積分
コンテスト
ユーザー Hachimori
提出日時 2016-03-05 15:32:25
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 78 ms / 5,000 ms
コード長 574 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 244 ms
コンパイル使用メモリ 77,976 KB
最終ジャッジ日時 2025-12-03 19:35:42
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#!/usr/bin/env python
#coding:utf8

import math

def read():
    raw_input()
    B = input()
    vList = map(float, raw_input().split())
    return B, vList


def work((B, vList)):
    total = 0
    for i in range(len(vList)):
        total += vList[i] * math.pow(B, vList[i] - 1)
    print "%.10lf" % total
    
    total = 0
    for i in range(len(vList)):
        if vList[i] == -1:
            total += math.log(B)
        else:
            total += math.pow(B, vList[i] + 1) / (vList[i] + 1)
    print "%.10lf" % total
    

if __name__ == "__main__":
    work(read())
0