正文

Center of Gravity2007-04-27 19:28:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/xiaoxiaofeng/25278.html

分享到:

  Center of Gravity Given a sector of radius R, central angle P. You are to calculate the distance between the center of gravity and the center of the circle. InputThere multiple test cases. Each case contains only one line containing 2 real numbers R and P(in radian), representing the radius and central angle of the sector. 0<R<=100, 0<P<=2*pi OutputFor each case, output one line containing the distance between the center of gravity and the center of the circle, accurate to 6 fractional digits. Sample Input0.01 6.28 Sample Output0.000003   扇形面積之重心,在其所對圓心角之角平分線上,距中心點O之距離為 x。 x=(2.0/3)*r*sin(p)/p; x=(2.0/3)*r*b/S; r為扇形之半徑p為扇形所對圓心角之一半(以弧度計) b為弦長,S為弧長    #include<stdio.h> #include<math.h> #define PI 3.1415926; int main() { double r,p; double dis; while(scanf("%lf%lf",&r,&p)!=EOF) { p/=2; dis=double(((2.0/3)*r*sin(double(p)))/p); printf("%.6lf\n",dis); } return 0; }

阅读(41) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册