数学公式推理,基本不等式运算
#include <iostream> #include <queue> #include <map> #include <set> #include <cmath> #include <cstring> #include <algorithm> #include <iomanip> #include <stack> #include <numeric> #include <ctime> #include <string> #include <bitset> #include <unordered_map> #include <unordered_set> using namespace std; using ll = long long; const ll N = 5e5 + 5, mod = 1e9 + 7, inf = 2e18; const double esp = 1e-9; int n; struct Node { double k, a, b; } a[N]; bool check(double mid) { double ans = 0; for (int i = 1; i <= n; i++) { ans += fabs(a[i].k * mid + a[i].a) + a[i].b; } return ans; } void solve() { double v, x, y; cin >> v >> x >> y; double ans = sqrt(y / x); double ans1 = v / x; cout << fixed << setprecision(10) << (ans >= ans1 ? 2 * ans - ans1 : y / v); } int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int t = 1; // cin >> t; while (t--) { solve(); } return 0; }