hdu 5206 Four Inages Strategy 计算几何】的更多相关文章

题目链接:HDU - 5206 Young F found a secret record which inherited from ancient times in ancestral home by accident, which named "Four Inages Strategy". He couldn't restrain inner exciting, open the record, and read it carefully. " Place four ma…
Four Inages Strategy Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5206 Description Young F found a secret record which inherited from ancient times in ancestral home by accident, which named "Four Inages Stra…
题目链接: hdu:http://acm.hdu.edu.cn/showproblem.php?pid=5206 bc(中文):http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=577&pid=1001 题解: 先判四点是否共面,然后再判断一下四条邻边相等并且两条对角线相等就可以了. #include<iostream> #include<cstdio> #include<cstring&…
题目大意: 判断空间上4个点是否形成一个正方形 分析: 标称思想 : 在p2,p3,p4中枚举两个点作为p1的邻点,不妨设为pi,pj,然后判断p1pi与p1pj是否相等.互相垂直,然后由向量法,最后一个点坐标应该为pi+pj−p1,判断是否相等就好了. 我的思想 : 枚举了各种情况,4条边相等+有一个角是直角.后来想想,因为是在三维中,有可能4个点不共面,这点没想到,不过这道题AC了,估计数据水了 #include<cstdio> #include<cstring> #inclu…
Higher Math Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2219    Accepted Submission(s): 1219 Problem Description You are building a house. You’d prefer if all the walls have a precise right…
Special Tetrahedron 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5839 Description Given n points which are in three-dimensional space(without repetition). Please find out how many distinct Special Tetrahedron among them. A tetrahedron is called Sp…
题目连接 :http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=577&pid=1001 题目大意:在三维空间中,给你四个点,判断是否可以组成一个正方形: 解题思路:首先判断四条边是否相等,判断方法取三个边如果两边相等且平方和相加等于第三边平方和即可,在判断是否有一个角为直角,判断方法取三点叉乘为0就为直角. AC代码: #include<iostream> #include<stdio.h> #…
How Many Triangles 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5784 Description Alice has n points in two-dimensional plane. She wants to know how many different acute triangles they can form. Two triangles are considered different if they differ…
Occupy Cities Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 509    Accepted Submission(s): 125 Problem Description The Star Wars is coming to an end as the Apple Planet is beaten by the Banan…
Beautiful Now Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1876    Accepted Submission(s): 707 Problem Description Anton has a positive integer n, however, it quite looks like a mess, so he…
HDU 4173 题意:已知n(n<=200)位參赛选手的住所坐标.现要邀请尽可能多的选手来參加一个party,而每一个选手对于离住所超过2.5Km的party一律不去,求最多能够有多少个选手去參加party. 思路: 最好还是先考虑party可能的位置,要尽可能多的邀请到选手參加,则仅仅需考虑party所在位置在某两位住所连线的中点上或某选手住所所在位置,由于这是最大參加party选手数非常有可能在的位置. 若其它位置能得到最大參加选手数.那么中点或选手住所也一定可得到. //反证法可得.试着…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6242 思路:当 n == 1 时 任取一点 p 作为圆心即可. n >= 2 && n < 5 时 此时有可能出现所有点共线,所以取任意俩点间中点作为圆的圆心. n >= 5 保证了有解.所以不可能有所有点共线的情况,随机取三个点在正解圆上的概率是 1/8,还是蛮大的.... 外学了下随机算法的写法....时间种子 time(0)要强制转成int,不然会WA,不造为啥....…
Weapon Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 22    Accepted Submission(s): 18 Problem Description Doctor D. are researching for a horrific weapon. The muzzle of the weapon is a circle.…
方法:选取一个点A,以点A为圆心做一个半径为r的圆,然后枚举另一个点B,以B为圆心做一个圆,如果这两个圆有交集,那我们在这个交集内选取一个点做半径为r的圆,这个圆就包括了A和B点,找到交集最多的区域并计算这个区域被覆盖的次数,把这个数加一就是最多能够覆盖的点个数,枚举所有的A,就可以得到最优解,剩下我想说的都在下面的图里,代码里也有相关注释; 这个题在比赛的时候我们并没有做出来,赛后看了题解才知道,由于作者的代码风格很好,所以不做修改,下面是作者的原博客地址: http://www.cnblog…
Time Limit: 1000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 930    Accepted Submission(s): 200 Problem Description Can you believe it? After Gardon had solved the problem, Angel accepted him! They were sitt…
守护雅典娜 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 740    Accepted Submission(s): 250 Problem Description 许多塔防游戏都是以经典的“守护雅典娜”为原型的.玩家需要建立各种防御工具来阻止怪物接近我们的女神——雅典娜. 这里,我们可以建造的防御工具只有标准圆形状的防御墙,建立在雅…
Problem Description Each person had do something foolish along with his or her growth.But,when he or she did this that time,they could not predict that this thing is a mistake and they will want this thing would rather not happened.The world king Sco…
Problem Description Have you ever played quoit in a playground? Quoit is a game in which flat rings are pitched at some toys, with all the toys encircled awarded.In the field of Cyberground, the position of each toy is fixed, and the ring is carefull…
题意:给定点A[0~n-1]和B[0],B[1],A[0].A[1]映射到B[0].B[1],求出其余点的映射B[2]~B[n-1]. 析:运用复数类,关键是用模板复数类,一直编译不过,我明明能编译过,交上就不过,只能写一个复数了... 代码如下: #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <iostream> #include…
6373.Pinball 物理受力分析题目. 画的有点丑,通过受力分析,先求出θ角,为arctan(b/a),就是atan(b/a),然后将重力加速度分解为垂直斜面的和平行斜面的,垂直斜面的记为a1,平行斜面的记为a2. a1=g*sinθ,a2=g*cosθ,然后算出小球到斜面的侧面高度h,以及小球到斜面底部的距离l,小球走h米高度所花费的时间t2为弹一次花费的时间,然后通过ll花费的时间t1为总时间,直接算倍数就是答案. 具体的代码注释. 代码: //1012-6373-几何-物理题目 #i…
给你最多1000个圆,问画一条直线最多能与几个圆相交,相切也算. 显然临界条件是这条线是某两圆的公切线,最容易想到的就是每两两圆求出所有公切线,暴力判断一下. 可惜圆有1000个,时间复杂度太高. 网上题解的做法是枚举每个“中心圆”,求出这个圆与其他圆的切线,然后按极角排序,扫一圈. 把每条切线看成扫入线——添加一个圆,或扫出线——删除一个圆. 形象一点就是一条与中心圆相切的直线,沿着中心圆滚了一圈,当这个直线碰到其他圆时,是添加了一个圆还是删除了一个圆. PS:这题C++交死活TLE,G++才…
Quoit Design Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 58566    Accepted Submission(s): 15511 Problem Description Have you ever played quoit in a playground? Quoit is a game in which flat…
思路: 随机增量法 (好吧这数据范围并不用) //By SiriusRen #include <cmath> #include <cstdio> #include <algorithm> using namespace std; typedef double db; int n; ],ans; P operator-(P a,P b){return P(a.x-b.x,a.y-b.y);} db dis(P a){return sqrt(a.x*a.x+a.y*a.y)…
其实这题最多是个小学奥数题- -,,看到别人博客各显神通,也有用微积分做的(我也试了一下,结果到最后不会积...). 思路如下(这两张图是网上找来的): 然后就很简单了,算三角形面积可以用海伦公式,也可以用1/2*a*b*sin(<a,b>).代码如下: #include <stdio.h> #include <algorithm> #include <string.h> #include <math.h> using namespace std…
Given a triangle field and a rope of a certain length (Figure-1), you are required to use the rope to enclose a region within the field and make the region as large as possible. Input The input has several sets of test data. Each set is one line cont…
LINK:Cupid's Arrow 前置函数 atan2 返回一个向量的幅角.范围为[Pi,-Pi) 值得注意的是 返回的是 相对于x轴正半轴的辐角. 而判断一个点是否在一个多边形内 通常有三种方法: 一种就是令这个点向多边形内所有边求角度的和 如果为2Pi 或者 -2Pi那么就在其中 一种是射线法 看这个点引出的射线和多边形的交点个数.奇数在内部 反之在外部. 面积判别法 看下和每条边所形成面积 是否等于多边形的面积. 前两者都还可以用于凹多边形 第三者我不太清楚. 这里使用的是第一种方法:…
/* hdu 2857 Mirror and Light 计算几何 镜面反射 */ #include<stdio.h> #include<string.h> #include<math.h> #include<algorithm> using namespace std; const double DNF=100000001.0; int t; double x1,x2,y11,y2,xs,ys,xe,ye; struct Point { double x;…
1001 Four Inages Strategy 题意:给定空间的四个点,判断这四个点是否能形成正方形 思路:判断空间上4个点是否形成一个正方形方法有很多,这里给出一种方法,在p2,p3,p4中枚举两个点作为p1的邻点, 不妨设为pi,pj,然后判断p1pi与p1pj是否相等.互相垂直,然后由向量法,最后一个点坐标应该为pi+pj−p1,判断是否相等就好了. #include <cstdio> using namespace std; struct node { __int64 x, y,…
Quoit Design Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 28539    Accepted Submission(s): 7469 Problem Description Have you ever played quoit in a playground? Quoit is a game in which flat…
Shape of HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4972    Accepted Submission(s): 2250 Problem Description 话说上回讲到海东集团推选老总的事情,最终的结果是XHD以微弱优势当选,从此以后,“徐队”的称呼逐渐被“徐总”所取代,海东集团(HDU)也算是名副其实了.…