码迷,mamicode.com
首页 >  
搜索关键字:humble    ( 105个结果
HDU 1058 Humble Numbers
既然将这道题分类到动态规划的题目里面,一开始便是用动态规划的思想去思考。一个上午毫无突破,看的人家的题解。定义四个伪指针存放下标,分别表示的意思是在已知的丑数中,能够与2,3,5,7相乘的最小的数的下标。上面这句话要好好体会。也就是说dp[p1] * 2 能够得到一个新的丑数,其他三个以此类推。但我...
分类:其他好文   时间:2014-07-06 20:41:32    阅读次数:223
【剑指offer】q34:丑数
题目要求第n个丑数,所以对于中间结果不需要保存。 def Humble(index): curHum = 1 M2 = 2; M3 = 3; M5 = 5 while index > 1: curHum = min(min(M2, M3), M5) while M2 <= curHum: M2 *= 2 while M3 <= curHum: M3 *= 3 w...
分类:其他好文   时间:2014-07-03 17:29:40    阅读次数:214
【剑指offer】Q40:数组中出现一次的数
书里面关于分类的判断有些麻烦,通过某一位为0为1来对数组元素进行分类。假如第3位为1,那么也就是元素x & 8 等于或不等于0,所以没必要非的用第几位去判断。 def once(array): reOR = 0 for x in array: reOR ^= x bit1 = firstBit1(reOR) first = 0 second = 0 for x in a...
分类:其他好文   时间:2014-07-03 13:54:06    阅读次数:182
poj 2247 Humble Numbers
Humble Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9396   Accepted: 4417 Description A number whose only prime factors are 2,3,5 or 7 is called a...
分类:其他好文   时间:2014-06-15 19:04:15    阅读次数:159
Humble Numbers
Humble Numbers 题目描述 A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the fi...
分类:其他好文   时间:2014-05-15 01:36:22    阅读次数:230
105条   上一页 1 ... 9 10 11
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!