fzu 1330:Center of Gravity(计算几何,求扇形重心)

Problem 1330 Center of Gravity

Accept: 443    Submit: 830
Time Limit: 1000 mSec    Memory Limit : 32768 KB

fzu 1330:Center of Gravity(计算几何,求扇形重心) Problem Description

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.

fzu 1330:Center of Gravity(计算几何,求扇形重心) Input

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.

fzu 1330:Center of Gravity(计算几何,求扇形重心) Output

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.

fzu 1330:Center of Gravity(计算几何,求扇形重心) Sample Input

0.01 6.28

fzu 1330:Center of Gravity(计算几何,求扇形重心) Sample Output

0.000003

 
  计算几何,求扇形的重心
  看的教程里有求扇形重心的公式,我就直接拿来用了:
  fzu 1330:Center of Gravity(计算几何,求扇形重心)
  
  可以看出,这里求的重心位置是重心到圆心的距离,正好是这道题求得值。
  代码
 #include <stdio.h>
#include <math.h>
int main()
{
double r,p;
while(scanf("%lf%lf",&r,&p)!=EOF){
double z; //扇形重心
p/=;
// 求扇形重心公式一
//double b = r*sin(p); //圆心角对应的弦长
//double s = p*r; //圆心角对应的弧长
//z = 2*r*b/(3*s);
//公式二
z = *r*sin(p)/(*p);
printf("%lf\n",z);
}
return ;
}

  PS:公式一是公式二的推导后的公式。

 

Freecode : www.cnblogs.com/yym2013

上一篇:centos6.5_64bit-禅道安装及数据库操作


下一篇:李宏毅《机器学习》学习笔记6