poj 2079 求一個平面所有點構成最大三角形的面積
#include<cstdio> #include<cmath> #include<algorithm> #define eps 1e-8 #define max(x,y) (((x)>(y))?(x):(y)) using namespace std; i […]
-->
程式前沿 幫助程式設計師解決問題,增加專業技能,提升個人能力與未來世界競爭力。
#include<cstdio> #include<cmath> #include<algorithm> #define eps 1e-8 #define max(x,y) (((x)>(y))?(x):(y)) using namespace std; i […]
題目連結: http://acm.hdu.edu.cn/showproblem.php?pid=2202 分析: 給出平面上的N個點,在其中找出三個點,使得其構成的三角形的面積最大。 題解: 先用找出凸包上的所有點,然後一次列舉遍歷即可。 1.求凸包: int cmp(point a, point […]
Description There are a lot of trees in an area. A peasant wants to buy a rope to surround all these trees. So at first he must know the minimal req […]
Description Once upon a time there was a greedy King who ordered his chief Architect to build a wall around the King’s castle. The King was so greedy, […]
Description Your friend to the south is interested in building fences and turning plowshares into swords. In order to help with his overseas adventure […]
Description 森林裡面有n棵貴重的樹,你需要將它們保護起來。保護樹木的方法是給它們做一個圍欄(專業術語叫“凸包”),但圍欄本身需要用這些樹來做,因此需要砍下一些樹。砍掉哪些樹才能讓損失的價值最小呢?如果有個解,取被砍掉的樹的數目最小的一組。你可以認為在這樣的限制下解是唯一的。 Inpu […]
Description 農夫約翰想要建造一個圍欄用來圍住他的奶牛,可是他資金匱乏。他建造的圍欄必須包括他的奶牛喜歡吃草的所有地點。對於給出的這些地點的座標,計算最短的能夠圍住這些點的圍欄的長度。 Input 輸入資料的第一行包括一個整數 N。N(0 <= N <= 10,000)表示 […]
題目意思很無聊, 你可以證明兩點。 A、 速度最大的才能到最遠點 B、 只有凸包邊上的點才能到無窮遠點。 然後就是一個無聊的凸包, 人站在一起並且速度相同的要排除掉。 。。被自己這個模板坑死了。 。。後來手動加上判是否在凸包上才過掉。。白浪費了3小時。。 #include <cstdio&g […]
前言 腦補知識點: 1.向量的內積(數量積,點乘): 公式:a· b = |a| * |b| cos<a, b>=a.x* b.y b.x * a.y 2.向量的外積(向量積,差乘): 公式:|c|= |a|*|b|*sin<a, b> = a.x * b.y […]
凸包問題的一般解法有:Graham演算法、Melkman演算法、Andrew演算法等 Andrew演算法是Graham演算法的變種。 由於Andrew演算法程式碼簡便,效率比較高,筆者更推薦使用Andrew演算法 參考部落格:凸包——Andrew演算法 #include<cstdio> […]