码迷,mamicode.com
首页 > 其他好文 > 详细

ACM--数学--湘大oj 1088--Cycloid

时间:2016-05-18 19:32:52      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:


 湘大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--数学--湘大oj 1088--Cycloid

标签:

原文地址:http://blog.csdn.net/qq_26891045/article/details/51407311

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!