Created
May 19, 2015 06:43
10209 - Is This Integration ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Tittle: 10209 - Is This Integration ? | |
* Author: Cheng-Shih, Wong | |
* Date: 2015/05/19 | |
*/ | |
// include files | |
#include <iostream> | |
#include <cstdio> | |
#include <cstring> | |
#include <cmath> | |
using namespace std; | |
// definitions | |
#define FOR(i,a,b) for( int i=(a),_n=(b); i<=_n; ++i ) | |
#define clr(x,v) memset( x, v, sizeof(x) ) | |
// declarations | |
const double PI = acos(-1.0); | |
double r; | |
double area; | |
double A, B, C; | |
// functions | |
// main function | |
int main( void ) | |
{ | |
area = PI/3.0 - 4.0*cos(PI*75/180)*sin(PI*75/180) + 2.0 - sqrt(3.0); | |
// input | |
while( scanf( "%lf", &r )==1 ) { | |
// solve | |
A = r*r*area; | |
B = r*r*(PI-2.0) - 2.0*A; | |
C = r*r - A - B; | |
// output | |
printf( "%.3lf %.3lf %.3lf\n", A, B, C ); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment