`
lilisalo
  • 浏览: 1125505 次
文章分类
社区版块
存档分类
最新评论

HDOJ/HDU 1115

 
阅读更多

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1115

Lifting the Stone

Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 1985Accepted Submission(s): 829


Problem Description
There are many secret openings in the floor which are covered by a big heavy stone. When the stone is lifted up, a special mechanism detects this and activates poisoned arrows that are shot near the opening. The only possibility is to lift the stone very slowly and carefully. The ACM team must connect a rope to the stone and then lift it using a pulley. Moreover, the stone must be lifted all at once; no side can rise before another. So it is very important to find the centre of gravity and connect the rope exactly to that point. The stone has a polygonal shape and its height is the same throughout the whole polygonal area. Your task is to find the centre of gravity for the given polygon.


Input
The input consists of T test cases. The number of them (T) is given on the first line of the input file. Each test case begins with a line containing a single integer N (3 <= N <= 1000000) indicating the number of points that form the polygon. This is followed by N lines, each containing two integers Xi and Yi (|Xi|, |Yi| <= 20000). These numbers are the coordinates of the i-th point. When we connect the points in the given order, we get a polygon. You may assume that the edges never touch each other (except the neighboring ones) and that they never cross. The area of the polygon is never zero, i.e. it cannot collapse into a single line.


Output
Print exactly one line for each test case. The line should contain exactly two numbers separated by one space. These numbers are the coordinates of the centre of gravity. Round the coordinates to the nearest number with exactly two digits after the decimal point (0.005 rounds up to 0.01). Note that the centre of gravity may be outside the polygon, if its shape is not convex. If there is such a case in the input data, print the centre anyway.


Sample Input
2 4 5 0 0 5 -5 0 0 -5 4 1 1 11 1 11 11 1 11


Sample Output
0.00 0.00 6.00 6.00


Source


Recommend
Eddy


直接套用模板,不过不知道为什么最后精度丢失了。。。。WA了许久。。

我的代码:


分享到:
评论

相关推荐

    HDU.rar_hdoj 2000 2999 chm_hdoj 2000-2099_hdu_hdu acm 20_杭电ACM

    “HDOJ”通常指的是杭电的在线判题系统,是众多ACMer进行算法训练和比赛的重要平台。在这个平台上,题目编号通常从1000开始,按照顺序递增。本压缩包聚焦于2000到2099的题目,这些题目涵盖了基础到进阶的各种算法...

    HDOJ1000

    ACM ICPC HDOJ1000

    hdu 部分解题代码 hdoj

    HDU(杭电在线评测系统,也称为HDOJ)是一个知名的在线编程竞赛平台,它提供了许多编程题目供用户练习和提升编程技能。这个压缩包文件“hdu”包含了作者在解决HDU平台上的一些问题时编写的解题代码。下面我们将深入...

    hdu4405_HDOJ_ACM_

    【标题】"hdu4405_HDOJ_ACM_" 指的是在杭州电子科技大学(HDU)的在线判题系统(Online Judge,简称OJ)上的一道编程竞赛题目,它属于HDOJ ACM系列。这个系列通常与国际大学生程序设计竞赛(ACM/ICPC)相关,这类...

    hdoj 2013 多校训练3标程+解题报告

    【标题】"hdoj 2013 多校训练3标程+解题报告"涉及的是2013年HDOJ(HDU Online Judge)组织的一次多校联合编程训练活动,其中“标程”指的是官方提供的正确解题代码,“解题报告”则是对题目解法的详细分析和总结。...

    HDOJ.rar_HD_HDOJ

    【标题】"HDOJ.rar_HD_HDOJ" 是一个与HDU(杭州电子科技大学)在线判题系统HDOJ相关的压缩包文件,其中包含了大量编程题目的源代码。 【描述】提到,这个压缩包包含了几百道HDOJ题目的源代码,这意味着它是一个宝贵...

    hdoj解题代码

    这些文件是针对“hdoj”(HDU Online Judge)在线编程竞赛平台的解题代码,涵盖了题目编号从1000到1050的若干题目。HDU Online Judge是一个用于训练和测试编程技能的系统,用户可以提交代码解决各种算法问题,并获取...

    hdoj1002——大整数相加

    ### hdoj1002——大整数相加 #### 题目背景与目的 本题目来源于杭州电子科技大学的在线评测系统(HDOJ),编号为1002的大整数相加问题。该题目主要考察的是编程者对于大整数处理的基本技巧以及对数组、循环等基础...

    HDOJ2019(杭电多校第一场的数据与标程).zip

    【标签】"acm hdu" 指出这个资源与ACM竞赛和杭州电子科技大学的在线评测平台HDOJ有关。ACM竞赛是全球范围内的大学生编程比赛,旨在提升学生的算法设计和问题解决能力。而HDOJ是杭电为支持ACM竞赛训练和线上练习而...

    HDU1005

    ACM ICPC HDOJ 1005

    HDOJ(杭州电子科技大学online jugle)题目分类

    hdoj的一些题目分类,由hdu大牛搜集,希望对做ac的同志们有帮助

    hdu排序练习

    标题:“hdu排序练习”与描述“hdu ACM 各种排序”共同指向了HDOJ(Hangzhou Dianzi University Online Judge)平台上的排序算法练习。HDOJ是计算机科学与技术领域内,尤其是算法设计与分析方向,非常受欢迎的一个...

    HDOJ1004

    ACM ICPC HDOJ1004

    hdoj 2013 多校训练2标程+解题报告

    “hdoj 2013 多校训练2标程+解题报告”这个标题指的是2013年举行的一场由hdoj(HDU Online Judge,即杭州电子科技大学在线评测系统)组织的多校联合编程训练活动的第二阶段。其中,“标程”是指官方提供的正确解答...

    HDOJ4515[源代码+数据].DateCalculator

    标题中的“HDOJ4515[源代码+数据].DateCalculator”表明这是一个与在线编程挑战平台HDOJ(HDU Online Judge)上的第4515题相关的项目,题目名为“DateCalculator”。该题可能涉及计算或比较日期的问题。源代码文件...

    HDOJ杭州电子科技大学ACM离线版下载

    【标题】:“HDOJ杭州电子科技大学ACM离线版下载”揭示了关于在线编程竞赛平台的知识点,尤其是针对杭州电子科技大学(HDU)的在线判断系统(Online Judge,简称OJ)。这个离线版是为ACM(国际大学生程序设计竞赛,...

    leetcode和hdoj-Algorithm-Packages:算法包

    leetcode和hdoj 简介 主要用来记录算法刷题记录和一些模板 文件结构 leetcode 存放leetcode题目和周赛 atcoder 用于存放参与和vp的atcoder比赛 codeforces 用于存放参与和vp的cf比赛,比赛文件夹以比赛序号和div描述...

    hdoj杭电1000-2000部分解题报告

    “hdoj杭电1000-2000部分解题报告”这个标题指的是一个关于杭州电子科技大学(简称杭电)在线编程竞赛平台(HDU Online Judge,简称HDOJ)上的题目解题报告。这份报告涵盖了编号从1000到2000的题目,这是一段相当大...

    hdu题目分类

    从给定的信息来看,这是一份关于杭州电子科技大学(简称杭电)在线编程平台HDU Online Judge(简称HDOJ)的题目分类列表。这份列表为新手提供了按类别刷题的指南,帮助他们系统地提升算法和编程能力。下面,我们将...

Global site tag (gtag.js) - Google Analytics