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 ...
随机推荐
- ASP 中调用函数关于Call使用注意的问题
Function TestFun(Tstr) TStr = "Fun2" End Function Sub TestSub(TStr) Tstr = "Sub2" ...
- 2014多校第十场1002 || HDU 4972 A simple dynamic programming problem
题目链接 题意 : 每次无论哪个队投进一个篮球,就记下现在两队比分的差值,问你最后的结果有多少种情况. 思路 : 该题实在是不好理解,最后的结果有多少种情况就是说不管中间过程怎么来的,只要最后结果不一 ...
- hdu 3658 How many words
思路: 构造矩阵,矩阵快速幂!!! 代码如下: #include<cstdio> #include<vector> #include<cmath> #include ...
- linux下如何查看和修改系统BLOCK的大小
http://blog.163.com/drachen@126/blog/static/162607494201271435333906/ 查看os系统块的大小 [root]# /sbin/tune2 ...
- ffmpeg转码MPEG2-TS的音视频同步机制分析
http://blog.chinaunix.net/uid-26000296-id-3483782.html 一.FFmpeg忽略了adaptation_field()数据 FFmpeg忽略了包含PC ...
- asp.net+swfupload 多图片批量上传(附源码下载)
asp.net的文件上传都是单个文件上传方式,无法执行一次性多张图片批量上传操作,要实现多图片批量上传需要借助于flash,通过flash选取多个图片(文件),然后再通过后端服务进行上传操作. 本次教 ...
- 317. Shortest Distance from All Buildings
题目: Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where th ...
- Android 使用全局变量传递数据
使用全局变量传递数据,所谓的全局变量类似于jee开发中的application变量.申明后,全局调用.只有当内存被清理后,才被销毁.否则一直可以调用. 还是使用点击一个button,传递一个数据到另一 ...
- JVM生产环境参数实例及分析
java application项目(非web项目) 改进前: -Xms128m-Xmx128m-XX:NewSize=64m-XX:PermSize=64m-XX:+UseConcMarkSweep ...
- WebBrowser控件应用:弹出新窗体和关闭窗口
缘起:上次写了一个<WebBrowser控件的简单应用2>,提到了在NewWindow事件中打开新窗口的例子.有网友“队长 ”提出那个事件得到的参数是本页面的,而不是新页面的,经过测试,果 ...