码迷,mamicode.com
首页 >  
搜索关键字:palindrome numbers    ( 9163个结果
[数位dp] spoj 10738 Ra-One Numbers
题意:给定x、y,为[x,y]之间有多少个数的偶数位和减去奇数位和等于一。 个位是第一位。 例子: 10=1-0=1 所以10是这样的数 思路:数位dp[i][sum][ok] i位和为sum 是否含有前导0. 然后就是因为有负数 所以根据范围把0设置为100 然后最后和等于101则为所求的数。 代码: [cpp] view plaincopyprint? #...
分类:其他好文   时间:2014-09-26 05:06:08    阅读次数:228
SQL Server 对象
第一项:重命名对象 execute sp_rename @objname='Nums',@newname ='Numbers',@objtype ='object'; go 这里要特别小心 @newname 这个参数不要带架构 如 :@newname ='dbo.Numbers' 这下就...
分类:数据库   时间:2014-09-26 01:00:57    阅读次数:226
【Leet Code】Palindrome Number
Palindrome NumberTotal Accepted:19369Total Submissions:66673My SubmissionsDetermine whether an integer is a palindrome. Do this without extra space.推断...
分类:其他好文   时间:2014-09-25 14:43:19    阅读次数:137
poj 1159 -- Palindrome
PalindromeTime Limit:3000MSMemory Limit:65536KTotal Submissions:53250Accepted:18396DescriptionA palindrome is a symmetrical string, that is, a string ...
分类:其他好文   时间:2014-09-25 14:30:59    阅读次数:150
[数位dp] spoj 10606 Balanced Numbers
题意: 对于一个数的每个位上的数。 对于每个奇数,如果出现必须出现偶数次。 对于每个偶数,如果出现必须出现奇数次。 思路: 用三进制存储每个数出现的状态,0没出现,1出现奇数次,2出现偶数次。 然后其他和普通数位dp就一样了。 代码: #include"cstdlib" #include"cstdio" #include"cstring" #include"cmath" #incl...
分类:其他好文   时间:2014-09-25 13:08:28    阅读次数:240
LeetCode:Decode Ways
题目链接A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message c...
分类:其他好文   时间:2014-09-25 01:02:47    阅读次数:240
HDU 3117 Fibonacci Numbers(矩阵快速幂+公式)
题目地址:HDU 3117 对于后四位可以用矩阵快速幂快速求出来,但前四位就没办法了。要知道斐波那契数列是有通项公式的,所以只能通过通项公式来求前四位,但公式不能求后四位,因为公式使用浮点数求的,精度显然不够,求前四位要用到对数。 通项公式为: f(n)=1/sqrt(5)(((1+sqrt(5))/2)^n+((1-sqrt(5))/2)^n) 假设F[n]可以表示成 t * 10^...
分类:其他好文   时间:2014-09-24 22:17:08    阅读次数:249
[数位dp] lightoj 1205 Palindromic Numbers
题意:给定范围内是回文数的个数。 思路:...
分类:其他好文   时间:2014-09-24 22:14:18    阅读次数:178
LeetCode——Permutations
PermutationsGiven a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3]...
分类:其他好文   时间:2014-09-24 04:02:35    阅读次数:212
UVA 10081 Tight numbers(POJ 2537)
直接看代码就OK。思路比较简单。就是注意概率要在转移过程中算出来。不能算成成立的方案书除以总方案数(POJ的这道题可以这么干。数据很水么。另外POJ要用%.5f,%.5lf 会WA。)#include #include #include #include #include #include #i.....
分类:其他好文   时间:2014-09-23 20:45:55    阅读次数:198
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!