多边形重心 UVA Blast the Enemy!
来源:互联网 发布:知道大数据 编辑:程序博客网 时间:2024/06/03 15:30
http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=13409
#include<stdio.h>#include<math.h>#include<string.h>#define eps 1e-6struct ss{ double x,y;};double Cross(ss t1,ss t2, ss t3){ return ((t2.x-t1.x)*(t3.y-t1.y)-(t2.y-t1.y)*(t3.x-t1.x))/2;}int main(){ //freopen("Input.txt","r",stdin); int i,n,ncase=1; double sum_area,sum_x,sum_y,area; while(scanf("%d",&n),n) { sum_area=0;sum_x=0;sum_y=0; ss a,b,c; scanf("%lf%lf%lf%lf",&a.x,&a.y,&b.x,&b.y); for(i=2;i<n;i++) { scanf("%lf%lf",&c.x,&c.y); area=Cross(a,b,c); sum_area+=area; sum_x+=area*(a.x+b.x+c.x); sum_y+=area*(a.y+b.y+c.y); b=c; } double cc=3*sum_area; //if(fabs(sum_area)<eps) printf("0.000 0.000\n"); //else printf("%.3f\n",fabs(sum_area)); //多边形面积 printf("Stage #%d: %.6f %.6f\n",ncase++,sum_x/cc,sum_y/cc); } return 0;}
- 多边形重心 UVA Blast the Enemy!
- poj - 3855 - Blast the Enemy!
- LA 4426 Blast the Enemy!
- poj 3855 Blast the Enemy! (计算几何)
- hdoj1115Lifting the Stone【多边形重心】
- ZJU2015 Lifting the Stone - 任意多边形重心
- The centre of polygon (多边形重心)
- hdu1115Lifting the Stone(求多边形重心)
- HDU 1115 Lifting the Stone(多边形重心)
- hdu1115 Lifting the Stone (多边形重心)
- 【多边形重心】hdu 1115 Lifting the Stone
- Lifting the Stone(多边形重心问题)
- HDOJ 1115 Lifting the Stone 多边形重心
- Lifting the Stone(hdu1115)多边形的重心
- HDU 1115 Lifting the Stone(多边形重心)
- hdu1115 Lifting the Stone 多边形重心
- hdu 1115 Lifting the Stone【多边形重心】
- hdu_1115_Lifting the Stone(求多边形重心)
- 使用ArcGIS Server for Flex API 开发包agslib加载天地图2.0版球面墨卡托地图 .
- C# ColorDialog 用法
- 立博宣言
- Android图片加载
- magento memcache缓存配置
- 多边形重心 UVA Blast the Enemy!
- ACM HD215 七夕节
- UIApplicationDelegate研究之初探
- 五步轻松搞定Linux下的文件同步(备份)
- 堆和栈
- sqllite
- Automate Master Data Loads from BW to BPC
- 图灵奖
- http请求的参数和属性