我是個對電腦科學有興趣的學生,我會貼上我的學習歷程及生活心情,也請大大們多多指教。 :)

2015年5月19日 星期二

[UVa] 10209 - Is This Integration ?

題目網址: http://goo.gl/hfk13u

題意:
(from luckycat)


解法: 先解中間那塊,三角函數用一用就算的出來囉。

TAG: Math

注意:

程式碼:
/**
* 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;
}

沒有留言:

張貼留言

任何意見都樂意傾聽