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

来源:互联网 发布:java的发展和前景如何 编辑:程序博客网 时间:2024/06/10 17:54


 湘大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);    }}




1 0
原创粉丝点击