pku 1385 Lifting the Stone
来源:互联网 发布:昆山市宏观数据库 编辑:程序博客网 时间:2024/05/20 06:52
#include<stdio.h>#include<math.h>#define eps 1e-10typedef struct {int x;int y;} Point;Point point[1000005];inline double multily(Point A,Point B){ return A.x * B.y - A.y * B.x;}int main(){ int i,j,N,T=9; double t,cx,cy, area,sumx,sumy; scanf("%d",&T); while(T--) { scanf("%d",&N); for(i=0;i<N;i++) scanf("%d%d",&point[i].x,&point[i].y); area=sumx=sumy=0; for(i=0;i<N;i++) { j=(i+1)%N;//相邻点 t=multily(point[i],point[j]); area+=t; sumx+=(point[i].x+point[j].x)*t; sumy+=(point[i].y+point[j].y)*t; } if(fabs(area)<eps)cx=cy=0; else{ cx=sumx/3.0/area; cy=sumy/3.0/area; } printf("%.2lf %.2lf/n",cx,cy); } return 0;}
- pku 1385 Lifting the Stone
- poj 1385 Lifting the Stone
- POJ 1385 Lifting the Stone
- zoj 2105 || poj 1385 Lifting the Stone
- POJ 1385 Lifting the Stone 笔记
- 1115 Lifting the Stone
- hdoj1115 Lifting the Stone
- HDU-Lifting the Stone
- HDU1115 Lifting the Stone
- HDU1115 Lifting the Stone
- HDU 1115 Lifting the Stone
- HDU 1115 Lifting the Stone
- hdu-1115-Lifting the Stone
- Lifting the Stone 7.1.3
- hdu 1115 Lifting the Stone
- HDU 1115 Lifting the Stone
- HDU 1115 Lifting the Stone
- poj 1385 Lifting the Stone 多边形求重心
- VC 获取程序的版本号
- 分布式缓存 - memCached Voldemort
- 使用svn merge恢复旧版本的原理
- SQL 研究- Common Table Expression
- ircd-hybrid支持多字节昵称(如:中文)
- pku 1385 Lifting the Stone
- windows常用命令以及快捷键大全
- 关于条件编译#ifdef...#endif
- 连接access
- tar用法
- C# 检测真实的文件类型函数
- Gridview用法大总结
- 在 Java 平台上进行多线程编程的缺陷
- IE与Firefox的CSS兼容大全