結果
| 問題 | No.347 微分と積分 |
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2026-02-05 00:18:27 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 646 bytes |
| 記録 | |
| コンパイル時間 | 4,066 ms |
| コンパイル使用メモリ | 336,980 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-02-05 00:18:33 |
| 合計ジャッジ時間 | 5,400 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / 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)
using ll = long long;
using ull = unsigned long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n;
double b;
cin >> n >> b;
vector<double> a(n);
rep(i, n) cin >> a[i];
{
double ans = 0;
rep(i, n) ans += a[i] * pow(b, a[i] - 1);
cout << fixed << setprecision(15) << ans << '\n';
}
{
double ans = 0;
rep(i, n) {
if (a[i] == -1)
ans += log(b);
else
ans += 1.0 / (a[i] + 1) * pow(b, a[i] + 1);
}
cout << fixed << setprecision(15) << ans << '\n';
}
return 0;
}
a01sa01to