題意:
(from luckycat)
解法: 先解中間那塊,三角函數用一用就算的出來囉。
TAG: Math
注意:
程式碼:
This file contains 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; | |
} |
沒有留言:
張貼留言
任何意見都樂意傾聽