fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. float a,b; cin >> a >> b;
  8. int n=0;float t,tplus;
  9. do {
  10.  
  11. t=n*b + a/sqrt(n+1);
  12. tplus=(n+1)*b + a/sqrt(n+2);
  13. n++;
  14. } while (t>tplus);
  15. cout << t;
  16. return 0;
  17. }
Success #stdin #stdout 0.15s 5516KB
stdin
1000000000000000000 100
stdout
4.06325e+14