Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <cmath>
- #include <iomanip>
- #include <fstream>
- using namespace std;
- int main()
- {
- ifstream f("case2_input.txt");
- if (f)
- {
- ofstream g("Output.txt");
- while (!f.eof())
- {
- double a, b, c;
- f >> a >> b >> c;
- if (b <= a && c <= a)
- {
- g << fixed << setprecision(5) << b * c << endl;
- continue;
- }
- else
- {
- double s = a * a, s1 = 1;
- if (b < a * sqrt(2))
- {
- double h = a * sqrt(2) / 2. - b / 2.;
- s -= 2 * (h * h);
- }
- if (a * sqrt(2) > c)
- {
- double h = a * sqrt(2) / 2. - c / 2.;
- s -= 2 * (h * h);
- }
- s1 = (max(b, c) - (max(b, c) - a)) * min(b, c);
- g << fixed << setprecision(5) << max(s, s1) << endl;
- }
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment