HDU 1115 Lifting the Stone 多边形重心 模板体
来源:互联网 发布:程序员真的那么累吗 编辑:程序博客网 时间:2024/06/06 18:42
#include <iostream>#include <cstring>#include <cstdlib>#include <cstdio>#include <queue>#include <cmath>#include <algorithm>using namespace std;struct P{ double x,y;};int main(){ int T,n; int i,j; P p1,p2,p3; double X,Y,S,x,y,s; scanf("%d",&T); while(T--) { scanf("%d",&n); scanf("%lf %lf %lf %lf",&p1.x,&p1.y,&p2.x,&p2.y); for(X = 0,Y = 0,S = 0,i = 3; i <= n; ++i) { scanf("%lf %lf",&p3.x,&p3.y); x = (p1.x + p2.x + p3.x); y = (p1.y + p2.y + p3.y); s = ((p3.x - p1.x)*(p2.y - p1.y) - (p2.x - p1.x)*(p3.y - p1.y))/2; X += x*s; Y += y*s; S += s; p2 = p3; } printf("%.2lf %.2lf\n",X/S/3,Y/S/3); } return 0;}
- 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 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 acm 1115 Lifting the Stone(多边形重心)
- hdu-1115 Lifting the Stone(求多边形的重心)
- Oracle 12cR1 RAC Creating Services with PDBs
- ubuntu 10.04上vsftpd 3.0.2的编译安装
- hdu 2571 命运
- 《学习Objective-C》
- 天气预报接口
- HDU 1115 Lifting the Stone 多边形重心 模板体
- js--easyUI----jQuery easyui datagrid 点击某个单元格即进入编辑状态,焦点移开后,保存数据
- eclipse禁用js文件验证
- hdu 4421 Bit Magic (位分离+2-sat)
- IOS 代码总结 UIImage UILabel UIButton
- hdu 1176 免费馅饼
- android应用webview时js接口不能用的问题
- 二维数组名及下标
- opencv2.3.1安装、编译与配置