题意   裸的计算几何  求多边形重心;

#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的更多相关文章

  1. poj 1115 Lifting the Stone 计算多边形的中心

    Lifting the Stone Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  2. Lifting the Stone(hdoj1115)

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

  3. (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 ...

  4. Lifting the Stone(求多边形的重心—)

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

  5. hdu 1115 Lifting the Stone 多边形的重心

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

  6. Lifting the Stone(hdu1115)多边形的重心

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

  7. hdu 1115:Lifting the Stone(计算几何,求多边形重心。 过年好!)

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

  8. hdu 1115 Lifting the Stone (数学几何)

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

  9. Lifting the Stone(多边形重心)

    Lifting the Stone Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

随机推荐

  1. DBCP参数介绍

    参数分步介绍1)数据库连接相关    username="v10"    password="v10"    driverClassName="ora ...

  2. HDU 1026 Ignatius and the Princess I (BFS)

    题目链接 题意 : 从(0,0)点走到(N-1,M-1)点,问最少时间. 思路 : BFS..... #include <stdio.h> #include <string.h> ...

  3. poj 2975 Nim 博弈论

    令ans=a1^a2^...^an,如果需要构造出异或值为0的数, 而且由于只能操作一堆石子,所以对于某堆石子ai,现在对于ans^ai,就是除了ai以外其他的石子 的异或值,如果ans^ai< ...

  4. jsp中如何用jstl实现if(){}else if(){}else{}

    <c:choose> <c:when test="${条件}"> 情况1........... </c:when> <c:when tes ...

  5. iOS js oc相互调用(JavaScriptCore)(二)

    下来我们使用js调用iOS js调用iOS分两种情况 一,js里面直接调用方法 二,js里面通过对象调用方法 首先我们看第一种,直接调用方法. 其中用到了iOS的block 上代码 -(void)we ...

  6. DB2_SQL_常用知识点&实践

    DB2_SQL_常用知识点&实践 一.删除表中的数据(delete或truncate) 1 truncate table T_USER immediate; 说明:Truncate是一个能够快 ...

  7. RedHat7 部署ELK日志分析系统

    一.ELK的组成二.工作流程三.环境准备四.正式安装 一.ELK的组成 ELK由ElasticSearch.Logstash和Kibana三部分组成,每一部分的功能及特点如下图所示: 二.工作流程 在 ...

  8. Ubuntu环境下eclipse的hadoop开发

    在安装好hadoop伪分布式后,开始搭建eclipse的hadoop开发环境 我的版本信息如下: Ubuntu 版本 12.10 Hadoop版本 1.2.1 Java版本  1.6.0_31(命令j ...

  9. gearman安装及初次使用

    官网:  http://gearman.org/ 一篇文章: 利用Gearman实现异步任务处理 一.问题分析 问题:在性能测试过程中,发现用户管理平台在进行图片上传时,性能不佳. 分析:经过代码分析 ...

  10. Linux操作系统基础(四)保护模式内存管理(2)【转】

    转自:http://blog.csdn.net/rosetta/article/details/8570681 Linux操作系统基础(四)保护模式内存管理(2) 转载请注明出处:http://blo ...