【poj2079】 Triangle】的更多相关文章

http://poj.org/problem?id=2079 (题目链接) 题意 求凸包内最大三角形面积 Solution 旋转卡壳. 只会n²的做法,但是竟然过了.就是枚举每一个点,然后旋转卡壳另外两个点.先固定i,j这2个邻接的顶点.然后找出使三角形面积最大的那个k点.然后再固定i,枚举j点,由于k点是随着j点的变化在变化,所以k点不必从开头重新枚举. 之后去网上看了下O(n)的做法,当时就感觉有点鬼,打了一遍交上去Wa了,鬼使神差拍出一组数据好像可以把网上O(n)的做法全部卡掉,但是我也还…
[称号] Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [ [], [,4], [6,,7], [4,,8,3] ] The minimum path sum from top to bottom is 11 (…
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [      [2],     [3,4],    [6,5,7],   [4,1,8,3] ] The minimum path sum from top to b…
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [ [], [,4], [6,,7], [4,,8,3] ] The minimum path sum from top to bottom is 11 (i.e.,…
给定一个由数字组成的三角形,从顶至底找出路径最小和. Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [ [], [,4], [6,,7], [4,,8,3] ] The minimum path sum from…
题目: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [ [], [,4], [6,,7], [4,,8,3] ] The minimum path sum from top to bottom is 11 (i…
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [ [], [,4], [6,,7], [4,,8,3] ] The minimum path sum from top to bottom is 11 (i.e.,…
http://poj.org/problem?id=1085 (题目链接) 题意 A,B两人玩游戏,在一个大三角形上放火柴,若A放上一根火柴后成功组成一个三角形,那么这个三角形就归属于A,并且A被奖励再放一根火柴.最后谁三角形多谁就胜. 给出一个残局,判断是否存在先手必胜策略. Solution 最近一直在颓,好久没刷题了... 这就是神乎其技的极大极小搜索,其实也差不多就是个贪心,基本很少用上,因为很难判断估价函数的正确性..详情请见:http://blog.csdn.net/gwq5210/…
传送门 Description 把1……n这n个数中任取3个数,求能组成一个三角形的方案个数 Input 多组数据,对于每组数据,包括: 一行一个数i,代表前i个数. 输入结束标识为i<3. Output 对于每组数据,输出: 对应的方案个数 Sample Input Sample Output Hint n≤1e6. 三个数字x,y,z能组成三角形当且仅当对于任意顺序,都满足x+y>z. Solution 考虑把所有能组成的三角形按照最长边分类.因为三边长度互不相同,所以每个三角形都会被唯一…
题意:给定3n个点,保证没有三点共线,要求找到一组点的分组方案使得它们组成的三角形之间互不相交. n<=1e3 思路:以y为第一关键字,x为第二关键字,按x递减,y递增排序 #include<cstdio> #include<cstdlib> #include<algorithm> using namespace std; struct arr { int x,y,z; }a[]; int cas,n; bool cmp(arr a,arr b) { if(a.x…