上一页 1 ··· 52 53 54 55 56 57 58 59 60 ··· 71 下一页
摘要: Milking CowsThree farmers rise at 5 am each morning and head for the barn to milk three cows. The first farmer begins milking his cow at time 300 (measured in seconds after 5 am) and ends at time 1000. The second farmer begins at time 700 and ends at time 1200. The third farmer begins at time 1500 a 阅读全文
posted @ 2012-08-20 21:58 _雨 阅读(355) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1159这题以前见过 不会 今天做比赛又看到 知道自己不会 就没多想 后来CZ说是水题 最长公共子序列 我就开始想想到求正序和逆序的最长公共子序列 不知道对不对 就自己想了几个数据试了一下 都过了 就交了 还真蒙对了 ME了一次 又现学的滚动数组View Code 1 #include <iostream> 2 #include<cstdio> 3 using namespace std; 4 int dp[3][5001]; 5 int main() 6 { 7 int i = 0,j = 0,k,n; 8 char 阅读全文
posted @ 2012-08-18 17:51 _雨 阅读(257) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1328以每个点为圆心 d为半径 画圆 记录与x轴交出的区间 就变成区间覆盖的问题了 贪心若区间有重叠 区间重叠的地方放一个雷达就可以覆盖这几个区间的点了把该换成double 的数都换成double 这里WA了n次啊View Code 1 #include<stdio.h> 2 #include<iostream> 3 #include<algorithm> 4 #include<cmath> 5 using namespace std; 6 struct node 7 { 8 double d 阅读全文
posted @ 2012-08-18 17:45 _雨 阅读(207) 评论(0) 推荐(0) 编辑
摘要: A. Mountain Scenerytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle Bolek has found a picture with n mountain peaks painted on it. The n painted peaks are represented by a non-closed polyline, consisting of 2n segments. The segments go thro 阅读全文
posted @ 2012-08-18 17:40 _雨 阅读(345) 评论(0) 推荐(0) 编辑
摘要: Broken NecklaceYou have a necklace of N red, white, or blue beads (3<=N<=350) some of which are red, others blue, and others white, arranged at random. Here are two examples for n=29: 1 2 1 2 r b b r b r r b r... 阅读全文
posted @ 2012-08-17 17:56 _雨 阅读(161) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2187求出形成凸包的各边 找出最大的View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<string.h> 4 #include<algorithm> 5 using namespace std; 6 struct node 7 { 8 int x,y; 9 }q[50011];10 int dis(int x1,int y1,int x2,int y2)11 {12 return (x1-x2)*(x1-x2)+(y1- 阅读全文
posted @ 2012-08-16 22:36 _雨 阅读(173) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4377写了一下午也没找出规律 还剩十几分钟的时候CZ看出了规律 这时候再找正确的字典序已经晚了,,官方解题报告: 其实这是个挺有趣的题,你需要构造一个 1..N 的排列,使得其最长上升序列的长度和最长下降序列的长度的最大值最小。应该比较容易能够想到这个答案是 sqrt(N) 级别的,这个结论的证明可以参考吴文虎的那本组合数学 p21 。 当然这还没有结束,怎么找字典序最小的那个解呢?先看看完全平方数吧,对于 4 ,我们有 2 1 4 3 ,对于 9 ,我们有 3 2 1 6 5 4 9 8 7 。嗯... 阅读全文
posted @ 2012-08-16 22:32 _雨 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 叉积求面积hdu2036(模版题):http://acm.hdu.edu.cn/showproblem.php?pid=2036View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<string.h> 4 #include<math.h> 5 using namespace std; 6 struct node 7 { 8 int x,y; 9 }q[101];10 double cross(node a,node b)11 {12 return a.x*b.y-a.y*b.x 阅读全文
posted @ 2012-08-15 15:46 _雨 阅读(240) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4360从昨天下午纠结到现在 交了20多次 。。官方解题报告1001简单的图论题每条边除了有边权以外,还有一个字母标记。标记可以是“LOVE”里面任意字符。每个点,要拆成四个点,分别代表到达该点的标记为L,O,V,E的最短路。第一步就是求最短路,直接spfa就可以了。trick在于,至少要找到一个LOVE串,在只有一个节点的时候,有几条自环,至少必须走LOVE四条自环。此时,必须另外加一个节点表示开始节点。还有一个trick就是距离可能超过int。1 2 1314520 L1 2 1314520 O1 2 13 阅读全文
posted @ 2012-08-15 11:59 _雨 阅读(297) 评论(0) 推荐(0) 编辑
摘要: * 需要包含的头文件 */#include <cmath >/* 常用的常量定义 */const double INF = 1E200const double EP = 1E-10const int MAXV = 300const double PI = 3.14159265/* 基本几何结构 */struct POINT{ double x; double y; POINT(double a=0, double b=0) { x=a; y=b;} //constructor};struct LINESEG{ POINT s; POINT e; LINESEG(POIN... 阅读全文
posted @ 2012-08-14 10:27 _雨 阅读(321) 评论(0) 推荐(0) 编辑
上一页 1 ··· 52 53 54 55 56 57 58 59 60 ··· 71 下一页