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; }

评论