O_Egor

asdasdsadadas

Apr 6th, 2022 (edited)
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <cmath>
  4. #include <iomanip>
  5. #include <fstream>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.  
  11.     ifstream f("case2_input.txt");
  12.     if (f)
  13.     {
  14.         ofstream g("Output.txt");
  15.         while (!f.eof())
  16.         {
  17.             double a, b, c;
  18.             f >> a >> b >> c;
  19.            
  20.         if (b <= a && c <= a)
  21.         {
  22.             g << fixed << setprecision(5) << b * c << endl;
  23.             continue;
  24.         }
  25.         else
  26.         {
  27.             double s = a * a, s1 = 1;
  28.             if (b < a * sqrt(2))
  29.             {
  30.                 double h = a * sqrt(2) / 2. - b / 2.;
  31.                 s -= 2 * (h * h);
  32.             }
  33.             if (a * sqrt(2) > c)
  34.             {
  35.                 double h = a * sqrt(2) / 2. - c / 2.;
  36.                 s -= 2 * (h * h);
  37.             }
  38.  
  39.             s1 = (max(b, c) - (max(b, c) - a)) * min(b, c);
  40.             g << fixed <<  setprecision(5) << max(s, s1) << endl;
  41.         }
  42.         }
  43.  
  44.  
  45.     }
  46.     return 0;
  47. }
Add Comment
Please, Sign In to add comment