Problem 1330 Center of Gravity

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

 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.

 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.

 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.

 Sample Input

0.01 6.28

 Sample Output

0.000003

 
  计算几何,求扇形的重心
  看的教程里有求扇形重心的公式,我就直接拿来用了:
  
  
  可以看出,这里求的重心位置是重心到圆心的距离,正好是这道题求得值。
  代码
 #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

fzu 1330:Center of Gravity(计算几何,求扇形重心)的更多相关文章

  1. hdu 2105:The Center of Gravity(计算几何,求三角形重心)

    The Center of Gravity Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Ot ...

  2. hdu 1115:Lifting the Stone(计算几何,求多边形重心。 过年好!)

    Lifting the Stone Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others ...

  3. HDU 2105 The Center of Gravity (数学)

    题目链接 Problem Description Everyone know the story that how Newton discovered the Universal Gravitatio ...

  4. HDU 2105 The Center of Gravity

    http://acm.hdu.edu.cn/showproblem.php?pid=2105 Problem Description Everyone know the story that how ...

  5. hdu1115 Lifting the Stone(几何,求多边形重心模板题)

    转载请注明出处:http://blog.csdn.net/u012860063 题目链接:pid=1115">http://acm.hdu.edu.cn/showproblem.php ...

  6. POJ 2225 / ZOJ 1438 / UVA 1438 Asteroids --三维凸包,求多面体重心

    题意: 两个凸多面体,可以任意摆放,最多贴着,问他们重心的最短距离. 解法: 由于给出的是凸多面体,先构出两个三维凸包,再求其重心,求重心仿照求三角形重心的方式,然后再求两个多面体的重心到每个多面体的 ...

  7. UVALive 4426 Blast the Enemy! --求多边形重心

    题意:求一个不规则简单多边形的重心. 解法:多边形的重心就是所有三角形的重心对面积的加权平均数. 关于求多边形重心的文章: 求多边形重心 用叉积搞一搞就行了. 代码: #include <ios ...

  8. 牛客网暑期ACM多校训练营(第三场) J Distance to Work 计算几何求圆与多边形相交面积模板

    链接:https://www.nowcoder.com/acm/contest/141/J来源:牛客网 Eddy has graduated from college. Currently, he i ...

  9. 计算几何--求凸包模板--Graham算法--poj 1113

    Wall Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 28157   Accepted: 9401 Description ...

随机推荐

  1. OpenERP登录页面调整

    在OpenERP的登录页面中,有针对数据库管理的链接,为了安全起见,一般都会通过修改原始的XML来实现隐藏的目的.但这样每次重新安装以后,都要重新修改,很不方便,所以我们可以通过建立一个新模块的方式来 ...

  2. 升级Eclipse出错的解决办法“Updating Software” has encountered a problem: An error occurred while uninstalling

    运行 eclipse 把 eclipse exe 修改为 eclipse.exe.back 再运行 updates 升级成功

  3. http请求返回405

    普通情况下,是你用了默认method=get,须要改为post

  4. 【php写日志】php将日志写入文件

    php 写内容到文件,把日志写到log文件 <?php header("Content-type: text/html; charset=utf-8"); /******** ...

  5. sqlserver学习笔记(四)—— 创建table表

    1.新建数据库TestDB 2.为TestDB数据库新建表UserInfo 创建名为UserInfo的表,包括以上字段,其中ID为主键并设置标识规范,Nation设置默认值“中国”. 为表格添加一些数 ...

  6. Docker入门二

    容器管理 1.docker create创建一个容器,但容器并没启动,就和我们创建虚拟机一样,创建了虚拟机后没启动 [root@centos-02 ~]# docker create -it cent ...

  7. mongod安装

    mongod.exe --dbpath "D:\Program Files\MongoDB\log\log.txt" mongod.exe --dbpath "D:\Pr ...

  8. jquery 获取各种高宽

    获取浏览器显示区域(可视区域)的高度 :   $(window).height();   获取浏览器显示区域(可视区域)的宽度 : $(window).width();   获取页面的文档高度   $ ...

  9. IBM MQ 2035 或 2013认证错误的解决方法

    第一种方法: ALTER CHL(SYSTEM.BKR.CONFIG) CHLTYPE(SVRCONN) ALTER CHL(SYSTEM.ADMIN.SVRCONN) CHLTYPE(SVRCONN ...

  10. lua错误收集

    这里放一些我遇到的lua错误,希望大家分享一些错误给我,统一放在这里. 1.lua表的引用传值 上面的代码运行后会发现t2[2],t2[3]表里的内容也被删除了,实际上它们 与t2[1]表里的内容都是 ...