結果
| 問題 |
No.347 微分と積分
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-04-06 03:11:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 517 bytes |
| コンパイル時間 | 1,330 ms |
| コンパイル使用メモリ | 159,448 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-04 02:07:34 |
| 合計ジャッジ時間 | 2,293 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int(i)=0;(i)<(n);++(i))
#define in(T,V) T V;cin>>V;
int main(){
int N,B;
cin >> N >> B;
double a[11];
REP(i,N) cin >> a[i];
double r = 0;
REP(i,N) r += a[i] * pow(0.+B, a[i]-1);
cout << setprecision(12) << r << endl;
r = 0;
REP(i,N){
if(a[i] == -1.0){
r += log(0.+B);
} else {
r += pow(0.+B, a[i]+1)/(a[i]+1);
}
}
cout << setprecision(12) << r << endl;
}