码迷,mamicode.com
首页 >  
搜索关键字:palindrome numbers    ( 9163个结果
[leetcode]Decode Ways
Decode WaysA message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded me...
分类:其他好文   时间:2014-08-03 15:12:15    阅读次数:238
hdu 2817 A sequence of numbers(快速幂取余)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2817题目大意:给出三个数,来判断是等差还是等比数列,再输入一个n,来计算第n个数的值。 1 #include 2 #include 3 #include 4 #define m 200907 5 ...
分类:其他好文   时间:2014-08-03 15:02:35    阅读次数:188
POJ2309 BST
Consider an infinite full binary search tree (see the figure below), the numbers in the nodes are 1, 2, 3, .... In a subtree whose root node is X, we can get the minimum number in this subtree by repe...
分类:其他好文   时间:2014-08-03 12:49:15    阅读次数:229
Permutations leetcode java
题目:Given 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], [2,....
分类:编程语言   时间:2014-08-03 10:09:25    阅读次数:193
Triangle leetcode java
题目:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the....
分类:编程语言   时间:2014-08-03 04:40:04    阅读次数:351
POJ 1159 Palindrome 题解
本题的题意理解之后,就是求最长回文子序列 longest palindrome subsequence,这里注意子序列和子串的区别。 有两种求法,一种是直接求,相当于填矩阵右上对角阵,另一种是转化为longest common subsequence的求法。 最大难点就是要求内存不能使用二维的。 故此第一种方法是有点难度的,因为需要把二维矩阵的对角线转化为一维表记录,对好下标就好了。 第二中...
分类:其他好文   时间:2014-08-02 23:32:34    阅读次数:326
Codeforces Beta Round #91 (Div. 1 Only) E. Lucky Array
E. Lucky ArrayPetya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky...
分类:其他好文   时间:2014-08-02 23:22:24    阅读次数:389
UVA 11475 - Extend to Palindrome(KMP)
UVA 11475 - Extend to Palindrome 题目链接 题意:给定一个字符串,问需要补上最少的字符使他变成回文串 思路:KMP,把字符串逆序和原串做匹配,匹配到最后一个字符看匹配了多少个,就是最大重合部分,然后相应输出即可 代码: #include #include #include using namespace std; const i...
分类:其他好文   时间:2014-08-02 21:00:44    阅读次数:212
LightOJ 1205 - Palindromic Numbers (数位dp)
LightOJ 1205 - Palindromic Numbers (数位dp) ACM 题目地址:SPOJ MYQ10 Mirror Number 题意:  求[a,b]中回文的个数。 分析:  是SPOJ MYQ01的简单版...其实有非递归方法的。 代码: /* * Author: illuz * Blog: http:...
分类:其他好文   时间:2014-08-02 20:56:24    阅读次数:218
uva11151Longest Palindrome(递推)
题目;uva11151Longest Palindrome(递推) 题目大意:给出一个字符串,问它可以通过去掉些字符得到的最长的回文的长度。 解题思路:dp【i】【j】代表从字符串i位到j位最长的回文的长度。                   如果s【i】 == s【j】 , dp【i】【j】 = dp【i - 1】【j - 1】 + 2; 因为头尾相同,那么要求i到j的最...
分类:其他好文   时间:2014-08-02 13:00:43    阅读次数:182
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!