Skip to content

Commit

Permalink
10209 solved
Browse files Browse the repository at this point in the history
  • Loading branch information
ksaveljev committed Mar 21, 2012
1 parent 686e756 commit 1e111a2
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions 10209.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main(void) {
double a;
double PI = 2 * acos(0);

while (cin >> a) {

if (a == 0) {
cout << "0.000 0.000 0.000" << endl;
continue;
}

double x = a / 2;

double tmp = 0.5 * (x * sqrt(a * a - x * x) + a * a * atan(x / sqrt(a * a - x * x)));

double checkered = (a * a / 2 - tmp) * 2;
double dotted = a * a - PI * a * a / 4 - 2 * checkered;
double striped = a * a - 4 * checkered - 4 * dotted;

cout << fixed << setprecision(3) << striped << " " << dotted * 4 << " " << checkered * 4 << endl;
}

return 0;
}

0 comments on commit 1e111a2

Please sign in to comment.