# HDU1115 Lifting the Stone

#include<bits/stdc++.h>
using namespace std;
struct point {
double x,y;
point(){}
point(double _x,double _y):x(_x),y(_y){}
point operator - (const point &a) {return point(x-a.x,y-a.y);}
};
istream& operator >> (istream& in,point &p) {
cin>>p.x>>p.y;
return in;
}
int T,n;
double cross(point a,point b) { return a.x*b.y-a.y*b.x; }
double Area(point a,point b,point c) { return cross(b-a,c-a); }
int main() {
for(scanf("%d",&T);T;T-- ) {
double sum_x = 0, sum_y = 0, sum_s = 0;
point p1,p2,p3;
scanf("%d",&n);
cin>>p1;
cin>>p2;
for(int i = 2; i < n; i++) {
cin>>p3;
double S = Area(p1,p2,p3);
sum_s += S;
sum_x += (p1.x+p2.x+p3.x) * S;
sum_y += (p1.y+p2.y+p3.y) * S;
p2 = p3;
}
printf("%.2lf %.2lf\n",sum_x/sum_s/3,sum_y/sum_s/3);
}
}

• 本文已收录于以下专栏：

## hdu 1115

Lifting the Stone Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Other...
• ysc504
• 2013-04-17 09:41
• 1048

## ACM-计算几何之Lifting the Stone——hdu1115

ACM 计算几何 Lifting the Stone hdu1115 多边形重心模板

## HDU1115 Lifting the Stone

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

## hdu1115 Lifting the Stone 多边形重心

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

## hdu1115 Lifting the Stone （求多边形重心）

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

## HDU-Lifting the Stone

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

## hdu 1115 Lifting the Stone 计算几何

Problem Description There are many secret openings in the floor which are covered by a big heavy sto...

## Lifting the Stone 7.1.3

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

## HDU 1115 Lifting the Stone

Problem Description There are many secret openings in the floor which are covered by a big heavy st...

举报原因： 您举报文章：深度学习：神经网络中的前向传播和反向传播算法推导 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)