Saturday, June 20, 2015

UVa 10209 - Is This Integration ?

// UVa 10209 - Is This Integration ?

#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;

#define pi M_PI

int main() {
	double r;
	while (cin >> r) {
		double Asc = pi * r * r / 12;
		double b = 2 * r * sin(15 * pi / 180);
		double h = r * cos(15 * pi / 180);
		double m = (Asc - b * h / 2) * 4 + b * b;
		double n = (pi - 2) * r * r / 4 - m / 2;
		double o = (r * r - m - 4 * n) / 4;
		printf("%.3f %.3f %.3f\n", m, n * 4, o * 4);
	}
	return 0;
}

No comments:

Post a Comment