ACM--圆的摆线公式--湘大oj 1088--Cycloid


 湘大oj题目地址:传送门


Cycloid

时间限制: 1000 ms  |  内存限制: 65536 KB


Description

cycloid is the curve traced by a point on the rim of a circular wheel as the wheel rolls along a straight line. It is an example of a roulette, a curve generated by a curve rolling on another curve.


                                                                                                                --from wikipedia

Please calculate the area of an arch of a cycloid generated by a circle of radius r.

You may define pi as acos(-1.0).

 

Input

         The first line of the input consists of a single integer K (1 <= K <= 1,000), denoting the number of test cases. Then K lines follow, each contains a real number r (0.0 < r < 1e3), indicating the radius of circle.

 

Output

         For each test case, output a line containing one real number with exactly three digits after the decimal point, indicating the area of an arch.

 

Sample Input

2

1.0

3.5

 

Sample Output

9.425

115.454


============================傲娇的分割线============================


题目意思:求圆走过的那一部分弧线所围成的面积,这个有一个公式,摆线留下的面积等于圆的三倍


#include <stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int main(){
    int n;
    double r;
    scanf("%d",&n);
    while(n--){
       cin>>r;
       double x=3*acos(-1.0)*r*r;
       printf("%.3f\n",x);

    }

}




你可能感兴趣的:(数学,ACM,1088,1088,湘大OJ,Cycloid)