結果

問題 No.2971 無理積分
ユーザー eve__fuyuki
提出日時 2024-12-01 22:22:53
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 488 bytes
コンパイル時間 1,860 ms
コンパイル使用メモリ 193,492 KB
最終ジャッジ日時 2025-02-26 10:16:54
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#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); };
	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;
}
0