結果
| 問題 |
No.2971 無理積分
|
| コンテスト | |
| ユーザー |
eve__fuyuki
|
| 提出日時 | 2024-12-01 22:23:26 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 492 bytes |
| コンパイル時間 | 2,001 ms |
| コンパイル使用メモリ | 194,308 KB |
| 最終ジャッジ日時 | 2025-02-26 10:17:02 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 36 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
void fast_io() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
int main() {
fast_io();
int n;
cin >> n;
auto f = [&](double x) { return sqrt(x * x * x + n * n * n); };
double ans = 0;
int int_num = 1e4;
for (int i = 0; i < int_num; i++) {
double l = (double)i / int_num;
double r = (double)(i + 1) / int_num;
ans += (r - l) / 6 * (f(l) + 4 * f((l + r) / 2) + f(r));
}
cout << setprecision(16) << fixed << ans << endl;
}
eve__fuyuki