码迷,mamicode.com
首页 >  
搜索关键字:algorithm    ( 11758个结果)
hdu 1284 钱币兑换问题
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1284 思路:只有3个硬币,范围是32768,可以一个一个枚举硬币,如果只放价值为1的硬币,从d[1]递推到d[n];如果再加上价值为2的硬币,那么就从d[2]递推到d[n];在加上价值为3的硬币,就从d[3]递推到d[n].递推公式是d[j] = d[j] + d[j-i]; d[j]表示j有几...
分类:其他好文   时间:2014-08-04 21:34:28    阅读次数:293
hdu 1398 Square Coins
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1398 类似hdu 1284  hdu1028 code: #include #include #include #include #include using namespace std; int main() { int n,i,j; int dp[310]; me...
分类:其他好文   时间:2014-08-04 21:34:12    阅读次数:234
The application of the stack—Parentheses Matching(括号匹配)
The thought of the algorithm is as follows:(1) Initially set up an empty stack, sequentially read in parentheses;(2) If it is a right parentheses, or ...
分类:移动开发   时间:2014-08-04 21:26:37    阅读次数:340
MD5算法原理
MD5(单向散列算法)的全称是Message-Digest Algorithm 5(信息-摘要算法),经MD2、MD3和MD4发展而来。MD5算法的使用不须要支付不论什么版权费用。MD5功能: 输入随意长度的信息,经过处理,输出为128位的信息(数字指纹); 不同的输入得到的不同的结果(唯一性); ...
分类:其他好文   时间:2014-08-04 21:25:08    阅读次数:553
USACO Section 2.2 Party Lamps
/* ID: lucien23 PROG: lamps LANG: C++ */ /* * 此题的技巧之处就是需要注意到任何button只要按下2的倍数次就相当于没有按 * 所以其实只需要考虑4个按钮,每个按钮是否被有效按下过一次就好 * 直接使用枚举法,一共只有2^4=16种情况 * 对于每种情况需要知道被按下的有效次数(也就是被按下过的按钮数),必须满足 * (C-有效次数)%2=0...
分类:其他好文   时间:2014-08-04 17:59:57    阅读次数:190
USACO Section 2.2 Subset Sums
/* ID: lucien23 PROG: subset LANG: C++ */ #include #include using namespace std; int main() { ifstream infile("subset.in"); ofstream outfile("subset.out"); if(!infile || !outfile) { cout << ...
分类:其他好文   时间:2014-08-04 14:35:27    阅读次数:200
USACO Section 2.2 Runaround Numbers
/* ID: lucien23 PROG: runround LANG: C++ */ #include #include #include using namespace std; int main() { ifstream infile("runround.in"); ofstream outfile("runround.out"); if(!infile || !outfil...
分类:其他好文   时间:2014-08-04 14:22:27    阅读次数:173
First Missing Positive leetcode java
题目:Given an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm....
分类:编程语言   时间:2014-08-04 13:34:47    阅读次数:373
004-算法-贪心发法
一、概念:贪心法(Greedy algorithm),是在每一步选择中都采用在当期状态下最好或最有的选择,从而希望导致结果是最好或者最优的算法。 比如在旅行推销员问题中,如果履行原每次都选择最近的城市,这就是一种贪心算法。 贪心算法在有最优子结构的问题中,尤为有效。最优子结构的意思是局部最优解...
分类:其他好文   时间:2014-08-04 13:24:47    阅读次数:206
hdu 4902 Task schedule
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4907 解题思路:就是把空余的时间单独用一个数组存起来,然后查找时用二分查找。但是这题却WA啦好多次,当时想死的心都有啦,后面才发现时数组开小了。。。 code: #include #include #include #include #include using namespa...
分类:其他好文   时间:2014-08-04 11:11:43    阅读次数:215
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!