結果
| 問題 |
No.347 微分と積分
|
| コンテスト | |
| ユーザー |
kapo
|
| 提出日時 | 2016-05-17 20:13:24 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 462 bytes |
| コンパイル時間 | 573 ms |
| コンパイル使用メモリ | 64,476 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-06 05:18:58 |
| 合計ジャッジ時間 | 1,472 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
int main(void)
{
int n, b;
double f1 = 0, f2 = 0, t;
vector<double> a;
cin >> n >> b;
rep(i, 0, n) {
cin >> t;
a.push_back(t);
}
rep(i, 0, n) {
f1 += a[i] * pow(b, a[i] - 1);
}
rep(i, 0, n) {
if (a[i] == -1) f2 += log(b);
else f2 += (1 / (a[i] + 1)) * pow(b, a[i] + 1);
}
printf("%.5lf\n%.5lf\n", f1, f2);
return 0;
}
kapo