摘要:算法:以结束时间从小到大排序,枚举比当前开始时间小的剩余房间,有足够不另开房间,没有足够的就加上缺少多少。View Code #include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<vector>#include<string>#include<math.h>#include<map>#include<set>#include<algorithm>using namespa
阅读全文
摘要:算法:1.求出覆盖该岛的圆得区间, 將问题转换为求过出最少得点,保证每个区间至少有一个点。2.按区间的左端排序3.更新radView Code #include <stdio.h>#include <iostream>#include <stdlib.h>#include <string.h>#include <algorithm>#include <math.h>using namespace std;struct node{ double x, y; bool operator < (const node&
阅读全文
摘要:Saving HDUTime Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2171Accepted Submission(s): 977Problem Description话说上回讲到海东集团面临内外交困,公司的元老也只剩下XHD夫妇二人了。显然,作为多年拼搏的商人,XHD不会坐以待毙的。一天,当他正在苦思冥想解困良策的时候,突然想到了自己的传家宝,那是公司成立的时候,父亲作为贺礼送来的一个锦囊,徐父当时交代,不到万不得已的时候,不要打开它。“现在
阅读全文
摘要:这题思路百度的,自己的思路太差了,不行,百度到的思路非常巧妙,哪一段重合的次数最大就是要移动的时间*10...orz神牛们..View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 int main( ) 5 { 6 int N; 7 scanf("%d",&N); 8 while(N--) 9 {10 int M,a,b,i,j,c[210],temp;11 memset(c,0,sizeof(c));12 scanf("%d&
阅读全文
摘要:这道题的思路是对木棍的长度排序,如果相同再按重量排序,从小到大。这题不知道为什么,我用qsort排序是wrong answer ..一用sort排序时,就AC啦。。View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #include<algorithm> 5 using namespace std; 6 struct node 7 { 8 int l; 9 int w;10 }T[5010];11 bool cmp(node a,node b)12 {
阅读全文
摘要:刚开始的时侯,自己以为最优的解法,先按开始时间排序,如果相同再按照,结束时间排序,然后根据时间差得结果,可是一直wrong answer,百度了下别人的思路,才知道最优的解法,是按结束时间排序,想想也是.......贪心就是如何找最优解法。。。。。。。View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #include<algorithm> 5 using namespace std; 6 struct node 7 { 8 int i; 9 int
阅读全文