結果
| 問題 |
No.347 微分と積分
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-02-26 22:54:43 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 475 bytes |
| コンパイル時間 | 584 ms |
| コンパイル使用メモリ | 64,328 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-22 22:32:47 |
| 合計ジャッジ時間 | 1,401 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
using namespace std;
int main() {
int n, b;
cin >> n >> b;
vector<double> a(n, 0);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
double x1, x2;
x1 = x2 = 0;
for (int i = 0; i < n; i++) {
x1 += a[i] * pow(b, a[i] - 1.0);
if (a[i] == -1.0) {
x2 += log(b);
} else {
x2 += 1.0 / (a[i] + 1) * pow(b, a[i] + 1.0);
}
}
printf("%.15f\n", x1);
printf("%.15f\n", x2);
return 0;
}