hdu 1115 Lifting the Stone (数学几何)
Lifting the Stone
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 5203 Accepted Submission(s): 2155
//15MS 376K 695 B C++
#include<stdio.h>
#include<math.h>
#define N 1000005
struct node{
double x,y;
}p[N];
double getsum(node a,node b,node c)
{
return ((b.x-a.x)*(c.y-a.y)-(c.x-a.x)*(b.y-a.y))/2.0;
}
int main(void)
{
int t,n;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(int i=;i<n;i++)
scanf("%lf%lf",&p[i].x,&p[i].y);
double ss=,sx=,sy=;
for(int i=;i<n-;i++){
double ts=getsum(p[],p[i+],p[i+]);
ss+=ts;
sx+=ts*(p[].x+p[i+].x+p[i+].x);
sy+=ts*(p[].y+p[i+].y+p[i+].y);
}
printf("%.2lf %.2lf\n",sx/ss/,sy/ss/);
}
return ;
}
hdu 1115 Lifting the Stone (数学几何)的更多相关文章
- 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
题目链接:hdu 1115 计算几何求多边形的重心,弄清算法后就是裸题了,这儿有篇博客写得很不错的: 计算几何-多边形的重心 代码如下: #include<cstdio> #include ...
- hdu 1115 Lifting the Stone 多边形的重心
Lifting the Stone Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- hdu1115 Lifting the Stone(几何,求多边形重心模板题)
转载请注明出处:http://blog.csdn.net/u012860063 题目链接:pid=1115">http://acm.hdu.edu.cn/showproblem.php ...
- poj 1115 Lifting the Stone 计算多边形的中心
Lifting the Stone Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- hdu 1577 WisKey的眼神 (数学几何)
WisKey的眼神 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total S ...
- Hdoj 1115.Lifting the Stone 题解
Problem Description There are many secret openings in the floor which are covered by a big heavy sto ...
- (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:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
随机推荐
- 抓猫_KEY
抓猫 题面如下: [ 题目描述] 流浪猫布满城市的每一个角落, 非常影响市容市貌, 作为城市聘请的抓猫者, 你有一 种捕捉器, 一定可以捕捉到所有走到里面的猫, 更加幸运的是你有一个非常厉害的动物心理 ...
- dubbo之注册管理中心
一.在dubbo的框架中注册中心是必要的一个环节,这个也是分布式部署的一个必要环节.在dubbo的架构基本图中可以看出,基本上所有的服务都是通过注册中心进行注册,然后在通过注册中心,暴露出接口来. 二 ...
- logback.xml日志文件配置
放在resources目录下面就可以自动读取<?xml version="1.0" encoding="UTF-8"?> <configura ...
- Tomcat7后台通过get接收数据处理乱码
Tomcat7后台通过get接收数据处理乱码 //因为tomcat7 默认将用get传来的数据用ISO-8859-1封装, //将ajax传过来的值解码,再转码,//因为tomcat7 默认将用get ...
- php安全性问题
目录 常见攻击类型 1.sql注入: 2.xss攻击 3.csrf攻击: php安全三板斧:过滤输入.验证数据,以及转义输出. 1.数据过滤: 2.验证数据: 3.转义输出: laravel 中如何避 ...
- Visual Studio 2015 Test Explorer does not show anything
Problem After install Visual Studio 2015 community and NUnit Test Adapter, I cannot find test cases ...
- django1.11+xadmin的搭建
1.git clone https://github.com/sshwsfc/xadmin.git或者直接下载zip包 2..在项目根目录下建一个extra_apps的包,将xadmin源码包存放在里 ...
- 如何往eclipse中导入maven项目
现在公司中大部分项目可能都是使用maven来构建,假如现在摆在你面前有一个maven的项目,如果你要学习它,如何将它导入到像eclipse这样的集成开发工具中呢,以项目public_class_1为例 ...
- 域名添加www之后(或域名后加端口)无法访问(阿里云服务器)
当时在阿里云服务器上部署了一个api接口,通过APP调用一直很正常,突然无法访问了,然后测试调查发现,只要在域名前加上www,再通过域名加端口的方式访问的话, 显示的都是 :502 错误:还一直以为是 ...
- [JSON].getObj( keyPath )
语法:[JSON].getObj( keyPath ) 返回:[JSON] 说明:返回指定键名路径的JSON对象,指定键名路径不存在时返回空的toJson对象(强烈建议使用 [JSON].exists ...