上一页 1 ··· 48 49 50 51 52 53 54 55 56 ··· 61 下一页
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4509memset标记,挺不错的方法。。View Code 1 #include<iostream> 2 #include<cstring> 3 using namespace std; 4 5 6 int main(){ 7 int n; 8 while(~scanf("%d",&n)){ 9 int time[1440];10 int sh,eh,sm,em;11 memset(time,1,sizeof(time));//一... 阅读全文
posted @ 2013-03-22 15:01 ihge2k 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4508一开始还以为是一个01背包呢。。。看了第二组测试数据之后就发现是完全背包了。。。View Code 1 #include<iostream> 2 const int N=110; 3 using namespace std; 4 int dp[N*N*10]; 5 struct Node{ 6 int a,b; 7 }node[N]; 8 9 int main(){10 int n;11 while(~scanf("%d",&n)){12 for(i.. 阅读全文
posted @ 2013-03-22 11:11 ihge2k 阅读(762) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4502dp[i]表示前i天的最大收入。View Code 1 #include<iostream> 2 #include<algorithm> 3 #include<cstring> 4 const int N=110; 5 using namespace std; 6 int dp[N];//dp[i]表示前i天的最大收入 7 8 struct Node{ 9 int start,end;10 int value;11 }node[N*10];12 13 int 阅读全文
posted @ 2013-03-22 09:55 ihge2k 阅读(347) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4504View Code 1 /* 2 #include<iostream> 3 #include<cmath> 4 using namespace std; 5 int _count=0; 6 7 void dfs(int a,int b,int count){ 8 if(count==0){ 9 if(a>b)_count++;10 return ;11 }else if((b-a)<count){12 _count+=pow(... 阅读全文
posted @ 2013-03-22 09:17 ihge2k 阅读(437) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4501思路:dp[l][i][j][p]表示选前l件时花费i元,积分j,免费p时最大价值View Code 1 #include<iostream> 2 #include<cstring> 3 #include<algorithm> 4 const int N=104; 5 using namespace std; 6 7 struct Node{ 8 int price; 9 int score;10 int value;11 }node[N];12 int d 阅读全文
posted @ 2013-03-21 22:16 ihge2k 阅读(376) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2013-03-20 22:32 ihge2k 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2188好久以前看到过这种类似的题,当时不懂,今天看了一下博弈入门。。。然后就把这题顺利的切掉了。。。就是传说中的巴什博奕(BashGame)。巴什博奕(BashGame):只有一堆n个物品,两个人轮流从这堆物品中取物,规定每次至少取一个,最多取m个。最后取光者得胜。显然,如果n=m+1,那么由于一次最多只能取m个,所以,无论先取者拿走多少个,后取者都能够一次拿走剩余的物品,后者取胜。因此我们发现了如何取胜的法则:如果n=(m+1)r+s,(r为任意自然数,s≤m),那么先取者要拿走s个物品,如果后取 阅读全文
posted @ 2013-03-20 16:44 ihge2k 阅读(158) 评论(0) 推荐(1) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1725思路:几天前看到过这道题,当时没什么想法,今天心血来潮,就想尝试一下,1Y...orz...一开始先打个表,把13以内的阶乘都算出来,然后二分查找,二分查找的时候如果没有找到相等的,返回的位置是后一个。。。这样循环就可以了。View Code 1 #include 2 using namespace std; 3 int facs[13]={0,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600};//打表找出前12个的. 阅读全文
posted @ 2013-03-20 09:34 ihge2k 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2116题目大意就是给你两个k位数,然后相加,判断是否溢出。思路:如果一正一负,那肯定不会溢出,其他情况就都转化为二进制来做,只要判断最后结果的位数就行了。View Code 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int main(){ 7 int k; 8 while(~scanf("%d",&k)){ 9 __int64 n,m;10 scanf("%I64d%I6... 阅读全文
posted @ 2013-03-19 20:48 ihge2k 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2141最近想做做水题找找感觉。。orz,水题也不好切啊。。。一开始没分析,直接暴力,可想而知,TLE。。。然后就用了二分。。。wa了好几次。。View Code 1 #include 2 #include 3 const int MAXN=507; 4 using namespace std; 5 __int64 a[MAXN],b[MAXN],c[MAXN],d[MAXN*MAXN]; 6 7 int Binary_Search(__int64 number,int low,int high... 阅读全文
posted @ 2013-03-19 16:39 ihge2k 阅读(227) 评论(0) 推荐(0) 编辑
上一页 1 ··· 48 49 50 51 52 53 54 55 56 ··· 61 下一页