Advertisement
Pearlfromsu

B bsuir 1803232021

Mar 18th, 2023
740
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <unordered_map>
  3. #include <algorithm>
  4. #include <set>
  5. #include <iomanip>
  6. #include <string>
  7.  
  8. using namespace std;
  9.  
  10. double n, m, k;
  11.  
  12. bool canUse(double val) {
  13.     return (k <= (long long)(n / val) * (long long)(m/val));
  14. }
  15. int main()
  16. {
  17.     cin.tie(NULL);
  18.     cout.tie(NULL);
  19.     ios_base::sync_with_stdio(false);
  20.     cout << fixed << setprecision(10);
  21.    
  22.     cin >> n >> m >> k;
  23.     //NADO K SHTUK!
  24.    
  25.     double l = 0.000001, r = 1001, prev = 99999999999;
  26.     while (abs(((l + r) / 2.0) - prev) > 0.000001) {
  27.         double m = (l + r) / 2.0;
  28.    
  29.         if (canUse(m))
  30.             l = m;
  31.         else
  32.             r = m;
  33.         prev = m;
  34.     }
  35.     cout << (l + r) / 2.0;
  36.  
  37.     return 0;
  38. }
  39.  
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement