|
|
вернуться в форумWA#4 Why I have WA? #include <iostream> #include <cmath> using namespace std; int main() { double const pi = 3.14159265358979323846; double a; double r; cin >> a >> r; long double s = pi * r * r; if (r <= a / 2) { cout << roundl(s * 1000) / 1000; } else if (r >= ((a / 2) * sqrt(2))) { cout << (int) (a * a) << endl; } else { double cosx; cosx = (a / 2) / r; double rad; rad = acos(cosx) * 2; double segm = (r * r / 2) * (rad - sin(rad)); s = s - 4 * segm; cout << round(s * 1000) / 1000 << endl; } return 0; } |
|
|