結果

問題 No.347 微分と積分
ユーザー btk
提出日時 2016-02-27 00:39:45
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 465 bytes
コンパイル時間 1,307 ms
コンパイル使用メモリ 160,764 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-24 10:48:42
合計ジャッジ時間 2,209 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef double D;

int main() {
    cout<<fixed;
    cout<<setprecision(10);
    int N,B;cin>>N>>B;
    vector<D> a(N);
    for(auto& it : a)cin>>it;
    {
        D ans=0;
        for(auto& it : a)ans+=it*pow(B,it-1);
        cout<<ans<<endl;
    }
    {
        D ans=0;
        for(auto& it : a)
        if(it==-1.0)ans+=log(B);
        else ans+=pow(B,it+1)/(it+1);
        cout<<ans<<endl; 
    }
    return 0;
}
0