提交时间:2023-11-08 13:42:20
运行 ID: 109383
#include<bits/stdc++.h> using namespace std; double a,b,c; bool check(double mid) { double t1 = mid / c; double t2 = (mid - t1 * b) / (b + c); double m = t1 + (a - mid) / b; double n = t1 + t2 + (a - (t1 + t2) * b) / c; return m < n; } int main(){ cin >> a >> b>>c; double l = 0 , r = a; while(r-l > 1e-8){ double mid = (l+r)/2; if(check(mid)){ r = mid; }else{ l = mid; } } printf("%.2lf",l/c + (a-l)/b); return 0; }