結果
| 問題 |
No.347 微分と積分
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-13 23:33:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 523 bytes |
| コンパイル時間 | 1,549 ms |
| コンパイル使用メモリ | 169,324 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-01 05:36:24 |
| 合計ジャッジ時間 | 2,449 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define llong long long
int main() {
int n, b;
cin >> n >> b;
vector<double> a(n);
rep(i, n) cin >> a[i];
double div = 0.0;
rep(i, n) div += a[i] * pow(b, a[i]-1.0);
printf("%.6f\n", div);
double mul = 0.0;
rep(i, n) {
if(a[i] == -1.0) {
mul += log(b);
} else {
mul += pow(b, a[i]+1.0) / (a[i] + 1.0);
}
}
printf("%.6f\n", mul);
}