zoj 2105 Lifting the Stone
题意 裸的计算几何 求多边形重心;
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std; double a,b,c,d,e,f;
double mix( double x,double y,double xx,double yy ){return x*yy - xx*y;}
int main( )
{
int N,T; scanf("%d",&T);
while( T-- )
{
scanf("%d",&N); scanf("%lf%lf%lf%lf",&a,&b,&c,&d);
double sumx = ,sumy = ,suma = ;
for( int i = ; i <= N; i++ )
{
scanf("%lf%lf",&e,&f);
double area = mix(e-a,f-b,c-a,d-b)/2.0;
sumx += (( a+c+e )*area);
sumy += (( b+d+f )*area);
suma += area;
c = e; d = f;
}
sumx = int(sumx/suma/3.0*100000.0);
sumy = int(sumy/suma/3.0*100000.0);
printf("%.2lf %.2lf\n",sumx/100000.0,sumy/100000.0);
}
return ;
}
zoj 2105 Lifting the Stone的更多相关文章
- poj 1115 Lifting the Stone 计算多边形的中心
Lifting the Stone Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- Lifting the Stone(hdoj1115)
Lifting the Stone Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- (hdu step 7.1.3)Lifting the Stone(求凸多边形的重心)
题目: Lifting the Stone Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...
- Lifting the Stone(求多边形的重心—)
Lifting the Stone Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) T ...
- hdu 1115 Lifting the Stone 多边形的重心
Lifting the Stone Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- Lifting the Stone(hdu1115)多边形的重心
Lifting the Stone Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)To ...
- hdu 1115: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 (数学几何)
Lifting the Stone Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- Lifting the Stone(多边形重心)
Lifting the Stone Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
随机推荐
- PowerDesigner 将CDM、PDM导出为图片
选中所有对象(Ctrl + A),复制(Ctrl + C),打开系统的“画图”软件,粘贴(Ctrl + V),另存为BMP或者PNG格式即可. 如果是将图片粘贴到Word文档也是可行的.
- spring_150802_resource
接口Service: package com.spring.service; public interface DogPetService { public void queryAllDogPets( ...
- MongoDB (四) MongoDB 数据模型
在 MongoDB 中的数据有灵活的模式.在相同集合中文档并不需要有相同的一组字段或结构的公共字段的集合,文档可容纳不同类型的数据. MongoDB设计模式的一些考虑 可根据用户要求设计架构. 合并对 ...
- C#日期大全
DateTime dt = DateTime.Now; // Label1.Text = dt.ToString();//2005-11-5 13:21:25 // Label2.Text = dt. ...
- Ffmpeg解析media容器过程/ ffmpeg 源代码简单分析 : av_read_frame()
ffmpeg 源代码简单分析 : av_read_frame() http://blog.csdn.net/leixiaohua1020/article/details/12678577 ffmpeg ...
- Android 核心分析 之五基本空间划分
基本空间划分 Google给了我们一张系统架构图,在这张图上我们可以看到Android的大体框架组成. 11.jpg (175.6 KB, 下载次数: 0) 下载附 ...
- 怎么批量修改Word表格的宽度
怎么批量修改Word表格的宽度 怎么批量修改Word表格的宽度呢.Word表格可根据窗口自动调整表格宽度,使得所有的表格宽度和页面宽度一样.当页面设置了新的页边距后,所有的表格都需要调整新的宽度.或者 ...
- java异常——RuntimeException和User Define Exception
1.RuntimeException public class RuntimeException { public static void main(String[] args) { // TODO ...
- Lantern免费使用教程【转】
转自:http://www.mfbuluo.com/13710.html 自从谷歌去年退出中国后,可能是意识到中国市场的潜力,所说这款Lantern免费的软件,背后有谷歌的资助,这一点部落无法肯定. ...
- 真正理解 git fetch, git pull 以及 FETCH_HEAD【转】
转自:http://www.cnblogs.com/ToDoToTry/p/4095626.html 真正理解 git fetch, git pull 要讲清楚git fetch,git pull,必 ...