hdu 1115 Lifting the Stone(求n边形的重心)
来源:互联网 发布:网络上粑粑什么意思 编辑:程序博客网 时间:2024/06/07 14:56
hdu 1115 Lifting the Stone
公式及推导见黑书P373
#include<stdio.h>#include<string.h>#define MAXN 1000005struct point{ double x,y;}p[MAXN];double cross(point a,point b){ return a.x*b.y-a.y*b.x;}int main(){ int cas,n; scanf("%d",&cas); while(cas--) { scanf("%d",&n); for(int i=0;i<n;i++) scanf("%lf%lf",&p[i].x,&p[i].y); double sumx=0,sumy=0; double area=0; for(int i=0;i<n;i++) { double t=cross(p[i],p[(i+1)%n]); area+=t/2; sumx+=t*(p[i].x+p[(i+1)%n].x); sumy+=t*(p[i].y+p[(i+1)%n].y); } double x=sumx/(6*area), y=sumy/(6*area); printf("%.2lf %.2lf\n",x,y); } return 0;}
0 0
- hdu 1115 Lifting the Stone(求n边形的重心)
- 求重心-hdu-1115-Lifting the Stone
- 求凸多边形的重心 例:hdu 1115 Lifting the Stone
- HDU 1115 Lifting the Stone (求多边形的重心)
- hdu-1115 Lifting the Stone(求多边形的重心)
- HDU 1115 Lifting the Stone(求多边形重心)
- hdu 1115 Lifting the Stone (求重心)
- HDU 1115 Lifting the Stone(求多边形重心)
- hdu 1115 Lifting the Stone【求多边形重心】
- 求图形面积,重心 HDU Lifting the Stone 1115
- HDU 1115 Lifting the Stone(多边形重心)
- hdu 1115 Lifting the Stone (重心问题)
- 【多边形重心】hdu 1115 Lifting the Stone
- HDU 1115 Lifting the Stone(多边形重心)
- hdu 1115 Lifting the Stone【多边形重心】
- hdu 1115 Lifting the Stone【多边形重心】
- HDU 1115 Lifting the Stone (多边形重心)
- HDU 1115 Lifting the Stone ( 求多边形的重心:叉积)
- 美国x档案 豆瓣影评 事事无常
- 公司的Java框架应具备的通用功能
- CCDrawingPrimitives/CCDrawNode学习笔记
- OpenCV Machine Learning 之正态贝叶斯分类器源代码分析(Normal Bayes Classifier)
- Linux动态库搜寻路径
- hdu 1115 Lifting the Stone(求n边形的重心)
- ScrollView反弹效果 仿小米私密短信效果
- UIGestureRecognizer iphone 手势识别(点击,捏合,旋转,拖拽,轻扫,长按)
- Android之一Activity生命周期
- mongoDB学习
- CentOS从源码安装PostgreSQL
- UVa 10057 - A mid-summer night's dream.
- 杭电 2059 龟兔赛跑
- HDU 1007 Quoit Design (分治)