結果
| 問題 |
No.3359 ブリング根の3桁精度近似計算
|
| コンテスト | |
| ユーザー |
SnowBeenDiding
|
| 提出日時 | 2025-11-14 23:09:59 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 905 bytes |
| コンパイル時間 | 4,912 ms |
| コンパイル使用メモリ | 336,008 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-11-14 23:10:06 |
| 合計ジャッジ時間 | 5,951 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace atcoder;
using namespace std;
typedef long long ll;
double eps = 1e-12;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(5);
ll c;
cin >> c;
auto check = [&](double x) {
double y = x * x * x * x * x + x - c;
if (y <= 0) return 1;
return 0;
};
auto binary = [&]() {
int trial_ct = 80;
double L = 0.0, R = 2000000010.0;
double mid = L + (R - L) / 2.0;
while (trial_ct--) {
if (check(mid))
L = mid;
else
R = mid;
mid = L + (R - L) / 2.0;
}
return mid;
};
double ans = binary();
ans += eps;
ans = floor(ans * 1000) / 1000;
printf("%.3f\n", ans);
}
SnowBeenDiding