上一页 1 2 3 4 5 6 7 8 9 10 ··· 23 下一页
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2566假设一堆由1分、2分、5分组成的n个硬币总面值为m分,求一共有多少种可能的组合方式(某种面值的硬币可以数量可以为0)。输入数据第一行有一个正整数T,表示有T组测试数据;接下来的T行,每行有两个数n,m,n和m的含义同上。对于每组测试数据,请输出可能的组合方式数;每组输出占一行。Sample Input2 3 5 4 8Sample Output1 2【题解】: 这里没有给出n,m的范围,建议使用第三种【code3】方式解【code1】:暴力O(N*N) 1 #include 2 #include 3.. 阅读全文
posted @ 2013-09-10 21:09 crazy_apple 阅读(515) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4715【code】: 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 #define N 1000151 8 9 int prim[N+10];10 int hash[1000000];11 int mark[1000010];12 int cjsb[1000010];13 int hash_cnt=0;14 int lowbit(int i)15 {16 return i&-i;17 }18 v... 阅读全文
posted @ 2013-09-09 22:00 crazy_apple 阅读(221) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4710【code】: 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 #define N 1000151 8 9 int prim[N+10];10 int hash[1000000];11 int mark[1000010];12 int cjsb[1000010];13 int hash_cnt=0;14 int lowbit(int i)15 {16 return i&-i;17 }18 v... 阅读全文
posted @ 2013-09-09 21:57 crazy_apple 阅读(241) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4707【题目大意】:Lin Ji 的宠物鼠丢了,在校园里寻找,已知Lin Ji 在0的位置,输入N D,N表示校园中点的个数,D表示宠物鼠不可能在距离D之内,接下来N-1行,输入x,y,表示x与y相邻,(相邻两点之间的距离为1,不相邻为inf),不存在环结构。【题解】:用邻接表存储树形结构,然后用DFS遍历图【code】: 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 #define NN 100010 ... 阅读全文
posted @ 2013-09-09 21:23 crazy_apple 阅读(535) 评论(1) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4706【题目大意】: 用a-z排出N的形状,输出大小为3-10的N,如果超过z之后,重新从a开始下面是大小为3的N(其实这里的N是反的,呵呵)a ebdfc g大小为4的Nh ni mojl pk q【code】: 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 char str[11][11][11]; 8 int cnt; 9 10 void solve(int id)11 {12 int n=id,i;13 ... 阅读全文
posted @ 2013-09-09 21:17 crazy_apple 阅读(276) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4712Hamming DistanceTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 797Accepted Submission(s): 284Problem Description(From wikipedia) For binary strings a and b the Hamming distance is equal to the number o 阅读全文
posted @ 2013-09-09 20:54 crazy_apple 阅读(610) 评论(0) 推荐(0) 编辑
摘要: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=13051305: SubstringTime Limit: 2 Sec Memory Limit: 10 MB Submit: 12 Solved: 2 [Submit][Status][Web Board]DescriptionGiven a string s. The length of s is smaller than 1000. You are to caculate the number of different substrings of s.InputThere are mult 阅读全文
posted @ 2013-08-31 21:50 crazy_apple 阅读(390) 评论(0) 推荐(1) 编辑
摘要: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=13061306: ManorTime Limit: 1 Sec Memory Limit: 128 MB Submit: 125 Solved: 35 [Submit][Status][Web Board]DescriptionBob有n个正整数,他将这n个整数根据大小划分成两部分。对于小于等于k的整数放在集合A中,其余的放在集合B中。每次他从集合B中取出一个最大的值,将其变成0放入A集合中。然后将A集合中所有的元素都增加a,如果此时A中元素大于k,那么要将该元素放入B中,同时将B集合中剩余的元 阅读全文
posted @ 2013-08-31 21:17 crazy_apple 阅读(272) 评论(0) 推荐(0) 编辑
摘要: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=13121312: 榜单Time Limit: 1 Sec Memory Limit: 128 MB Submit: 222 Solved: 84 [Submit][Status][Web Board]DescriptionZZY很喜欢流行音乐,每周都要跟踪世界各地各种榜单,例如Oricon和Billboard,现在给出每周各个单曲的销量请给出每周的TOP5以及TOP5中各个单曲的浮动情况。量的排名是按照本周销量排名,而不是总销量。浮动情况则是较上周的排名变动,也就是说即使某单曲本周销量比上周的差 阅读全文
posted @ 2013-08-31 21:13 crazy_apple 阅读(183) 评论(0) 推荐(0) 编辑
摘要: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=13031303: DecimalTime Limit: 1 Sec Memory Limit: 128 MB Submit: 589 Solved: 61 [Submit][Status][Web Board]Description任意一个分数都是有理数,对于任意一个有限小数,我们都可以表示成一个无限循环小数的形式(在其末尾添加0),对于任意一个无限循环小数都可以转化成一个分数。现在你的任务就是将任意一个无限循环小数转化成既约分数形式。所谓既约分数表示,分子和分母的最大公约数是1。Input有多 阅读全文
posted @ 2013-08-31 21:09 crazy_apple 阅读(269) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 23 下一页