E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
palindrome
POJ1159——LCS+滚动数组——
Palindrome
Description A
palindrome
is a symmetrical string, that is, a string read identically from left to right
·
2015-11-07 14:58
poj
HDU 1513
Palindrome
【LCS】
题意:给出一个字符串s,问至少加入多少个字母让它变成回文串 解题思路:求出该字符串与该字符串翻转后的最长公共子序列的长度,再用该字符串的长度减去最长公共子序列的长度即为所求 反思:因为题目所给的n的范围为3<=n<=5000,所以dp[][]数组如果开到dp[5005][5005],会超内存,此时应该就用滚动数组来优化 滚动数组的详细介绍http://blog.csdn.net/
·
2015-11-07 14:53
HDU
Shortest
Palindrome
Shortest
Palindrome
Given a string S, you are allowed to convert it to a
palindrome
by adding characters
·
2015-11-07 11:52
LeetCode
Palindrome
Number (2 solutions)
Palindrome
Number Determine whether an integer is a
palindrome
. Do this without extra space.
·
2015-11-07 11:24
LeetCode
GOJ 1065
problem_id=1065 题意: 给一个字符串,求出最长的对称字符串,输出其长度, 这里的对称与一般的
palindrome
不同,这里允许跳跃.
·
2015-11-07 10:01
Go
UVa 11584 Partitioning by
Palindrome
s【DP】
题意:给出一个字符串,问最少能够划分成多少个回文串 dp[i]表示以第i个字母结束最少能够划分成的回文串的个数 dp[i]=min(dp[i],dp[j]+1)(如果从第j个字母到第i个字母是回文串) 想不明白的还是初始化 初始化为:dp[i]=i+1, 后来= =,发现应该是这样的 从第1个字母到第i个字母最多能够划分成i+1个回文串, 所以为了求最小值,每一个初始
·
2015-11-07 10:56
partition
Valid
Palindrome
Valid
Palindrome
问题: Given a string, determine if it is a
palindrome
, considering only alphanumeric
·
2015-11-07 09:53
ROM
Palindrome
Partitioning
Palindrome
Partitioning 问题: Given a string s, partition s such that every substring
·
2015-11-07 09:51
partition
[leetcode]
Palindrome
.Partitioning
Given a string s, partition s such that every substring of the partition is a
palindrome
.
·
2015-11-06 07:19
partition
poj3280Cheapest
Palindrome
链接:http://poj.org/problem?id=3280 题意: 现在有一个由n个字符组成的长度为m的字符串,可以对其通过增加字符或者删除字符来使其变成回文字符串,而增加或者删除字符都有一个花费, 求解使该字符串变成回文所进行操作的最小花费; 思路: dp3种基本思路: 1、一维线性dp:每次考虑i时,选择最优子问题要么在i-1,要么在1...i-1里; 2、二维线性dp:
·
2015-11-05 09:03
heap
hdu 1513
Palindrome
<最长公共子序列>
链接:http://acm.hdu.edu.cn/showproblem.php?pid=1513 最长公共子序列模版题。 View Code 1 #include <cstdio> 2 #include<iostream> 3 #include<string.h> 4 using namespace std; 5 cha
·
2015-11-05 09:42
HDU
Palindrome
Linked List (2 solutions)
Palindrome
Linked List Given a singly linked list, determine if it is a
palindrome
.
·
2015-11-05 08:25
LeetCode
HDU 4365
Palindrome
graph
题意:给你n*n的方格纸,在格子里填颜色,要满足任意水平、垂直翻转后看到的图形都一样; 对于n*n的方格纸,则可填 (n/2+1)*(n/2)/2 种颜色,如图。 我们就只要涂图中的那个三角形即可,由于是对称的那么其余的方格也就确定了颜色; 有些方格已经填了颜色,对于已填色的方格,会固定对应格子的颜色,使得可填颜色数减1.注意多个已填色格本来就是同色格,不
·
2015-11-05 08:32
Graph
算法竞赛入门经典(第一版) 第五章 解题报告
算法竞赛入门经典(第一版)第五章解题报告一、字符串题目A-
Palindrome
s题意:代码:B-Where'sWaldorf?
gscsdlz
·
2015-11-04 19:00
算法
代码
字符串
ACM
解题报告
java 记——课本例题,判断一个字符串是否是回文
{Scannerinput=newScanner(System.in);System.out.print("Enterastring:");Strings=input.nextLine();if(is
Palindrome
舒绾
·
2015-11-04 19:26
java 记——课本例题,判断一个字符串是否是回文
Scannerinput=newScanner(System.in); System.out.print("Enterastring:"); Strings=input.nextLine(); if(is
Palindrome
lily1143
·
2015-11-04 19:00
POJ 3974
Palindrome
求最长回文子串 Manacher
Palindrome
TimeLimit: 15000MS MemoryLimit: 65536KTotalSubmissions: 6206 Accepted: 2283DescriptionAndythesmartcomputersciencestudentwasattendinganalgorithmsclasswhentheprofessoraske
zp___waj
·
2015-11-04 13:00
C++
poj
manacer
Palindrome
Number
Palindrome
Number 问题: Determine whether an integer is a
palindrome
. Do this without extra space.
·
2015-11-03 21:57
number
Java for LeetCode 234
Palindrome
Linked List
JAVA实现如下:publicstaticbooleanis
Palindrome
(ListNodehead){ if(head==null||head.next==null) returntrue;
TonyLuis
·
2015-11-03 20:00
POJ 1159
Palindrome
题意:插入字符来得到回文串,求插入字符最小数目 思路:递归方程dp[i][j], 下来三者的最小值:如果str[i] 等于 str[j] 时 dp[i+1][j-1]; dp[i+1][j] + 1(在str[j]后面插入一个与str[i]相同的字符); dp[i][j-1] +1(在str[i]前面插入一个与str[j]相同的字符)。子问题填表,从(0,0)到(n, n)对角线向上填。 代码
·
2015-11-02 19:54
poj
Epic -
Palindrome
s
Print all
palindrome
s of size greater than or equal to 3 of a given string.
·
2015-11-02 19:44
ROM
Leetcode 9
Palindrome
Number
Determine whether an integer is a
palindrome
. Do this without extra space. 利用余数构造倒置数再判断。
·
2015-11-02 19:41
LeetCode
Leet
Palindrome
Partitioning II
1 class Solution { 2 public: 3 int minCut(string s) { 4 int len = s.length(); 5 int* p_dp = new int[len + 1]; 6 char* s_dp = new char[len * len]; 7 in
·
2015-11-02 19:09
partition
LeetCode
Palindrome
Partitioning
1 class Solution { 2 public: 3 vector<vector<string> > partition(string s) { 4 int len = s.length(); 5 vector<vector<string> >* memo = new vector&l
·
2015-11-02 19:08
partition
欧拉计划 第4题
The largest
palindrome
made from the product of two 2-digit numbers is 9009 = 91 * 99.Find the largest
·
2015-11-02 19:09
欧拉计划
Ural 1297
Palindrome
(后缀数组)
题目地址:Ural1297后缀数组模板题。把字符串倒过来接到字符串后面,并在中间加一个从未出现的字符。然后用后缀数组就可以了。代码如下:#include #include #include #include #include #include #include #include #include #include #include usingnamespacestd; #defineLLlongl
u013013910
·
2015-11-02 19:00
编程
ACM
后缀数组
算法与数据结构
leetcode reverse integer&&
Palindrome
Number
t=x%10; ret=ret*10+t; x=x/10; } return ret; }} public class Solution { public boolean is
Palindrome
·
2015-11-02 18:35
LeetCode
UVA 401
Palindrome
s
字符串处理。 CODE: #include <iostream> #include <cstdlib> #include <cstdio> #include <ctype.h> #include <cstring> using
·
2015-11-02 18:39
ROM
USACO section 1.5.2 Prime
Palindrome
s
1. 无数遍TLE的题,快疯了,最后没办法,只能看别人的代码,最好的一个代码,写了下来,但是还有一点地方不太明白,这是一种新的方法, 以下是代码 /* ID: dollar4 PROG: pprime LANG: C++ */ #include <iostream> #include <fstream> #include <string> #includ
·
2015-11-02 18:11
USACO
USACO section 1.2.4 Dual
Palindrome
s
1. 直接用了上道题的函数,另外,进制转换: string trans(int a) { string str1 = ""; int tmp; while (a) { tmp = a % base; if (tmp < 10) str1 += tmp + '0';
·
2015-11-02 18:07
USACO
Palindrome
Determine whether an integer is a
palindrome
. Do this without extra space.
·
2015-11-02 17:56
ROM
LeetCode题解(9)--
Palindrome
Number
Determine whether an integer is a
palindrome
. Do this without extra space.
·
2015-11-02 17:38
LeetCode
Valid
Palindrome
https://oj.leetcode.com/problems/valid-
palindrome
/ Given a string, determine if it is a
palindrome
,
·
2015-11-02 17:27
ROM
URAL1635——DP+回溯——Mnemonics and
Palindrome
s
Description The student Vasechkin was terribly unlucky at his oral examination. Of 42 examination questions, he didn't prepare only the last one, and he was asked exactly that question. Vasechkin w
·
2015-11-02 16:02
ROM
UVa 11584 Partitioning by
Palindrome
s
题意: 给出一个字符串,求最少能划分成多少个回文子串。 分析: d[i] = min{d[j] + 1 | s[j+1]...s[i]是回文串} d[i]表示前 i 个字符最少能分割的回文子串的个数 字符串从s[1]开始,边界d[0] = 0; 预处理:用从中间想两边拓展的方法,用flag[i][j]表示s[j]...s[i]是否是回文串 1 //#defi
·
2015-11-02 15:59
partition
(Problem 36)Double-base
palindrome
s
The decimal number, 585 = 10010010012 (binary), is palindromic in both bases. Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2. (Please note that
·
2015-11-02 12:10
double
(Problem 4)Largest
palindrome
product
The largest
palindrome
made from the product of two 2-digit numbers is 9009 = 91 99.
·
2015-11-02 12:05
ROM
POJ - 3974
Palindrome
DescriptionAndy the smart computer science student was attending an algorithms class when the professor asked the students a simple question, "Can you propose an efficient algorithm to find the l
·
2015-11-02 12:53
poj
pku 3280 Cheapest
Palindrome
DP
http://poj.org/problem?id=3280 题意: 给定一个长度为m的字符串(都是小写字母) ,求通过添加或者删减若干个字符是原字符串变为回文串的最小代价(这里给出n个字符的删除与添加所需的代价,规定添加和删除的字符串都在给定的这n个字符中); 思路: 只能说自己dp太弱了,以后有时间一定要多练习dp。 这里对字符串从两端开始进行比较如果相同则dp[i][j
·
2015-11-02 11:16
heap
POJ (Manacher)
Palindrome
多敲几个模板题,加深一下对Manacher算法的理解。 这道题给的时间限制15s,是我见过的最长的时间的了。看来是为了让一些比较朴素的求最大回文子串的算法也能A过去 Manacher算法毕竟给力,运行时间200+MS 1 //#define LOCAL 2 #include <iostream> 3 #include <cstdio>
·
2015-11-02 11:26
poj
HDU 1513
Palindrome
题目就是给一个字符串问最少插入多少个字符能让原字符串变为回文字符串。 算法: 用原串的长度减去原串与翻转后的串的最大公共字串的长度,就是所求答案。 1 //#define LOCAL 2 #include <iostream> 3 #include <cstring> 4 #include <algorithm>
·
2015-11-02 11:59
HDU
UVa401 回文词
Palindrome
s A regular
palindrome
is a string of numbers or letters that is the same forward as backward
·
2015-11-02 11:28
uva
最长回文子串
6645824http://zhuhongcheng.wordpress.com/2009/08/02/a-simple-linear-time-algorithm-for-finding-longest-
palindrome
-sub-string
·
2015-11-02 11:32
回文
15-2求最大回文的长度
#ifndef
PALINDROME
_H_ #define
PALINDROME
_H_ #include<iostream>
·
2015-11-02 11:33
长度
LeetCode131:
Palindrome
Partitioning
题目: Given a string s, partition s such that every substring of the partition is a
palindrome
.
·
2015-11-02 10:33
partition
[zz]O(n) 回文字串算法
原文地址:http://zhuhongcheng.wordpress.com/2009/08/02/a-simple-linear-time-algorithm-for-finding-longest-
palindrome
-sub-string
·
2015-11-02 09:52
算法
Manacher算法--O(n)回文子串算法
原文地址:http://zhuhongcheng.wordpress.com/2009/08/02/a-simple-linear-time-algorithm-for-finding-longest-
palindrome
Aiphis
·
2015-11-02 08:40
poj 1159
palindrome
(dp)
http://poj.org/problem?id=1159 卡内存的题比卡时间的题还要恶心! 用int类型提交就MLE,只能换成short int,65128K,Memory Limit: 65536K...表示很无语。 不会灵活运用滚动数组,这题考查的不只是DP,应该还有滚动数组的应用。 DP代码: #include<iostream> #inclu
·
2015-11-01 16:31
poj
UVA 11584 Partitioning by
Palindrome
s
Partitioning by
Palindrome
s Time Limit: 1000ms Memory Limit: 131072KB This problem will be judged
·
2015-11-01 15:08
partition
URAL 1297
Palindrome
Palindrome
Time Limit: 1000ms Memory Limit: 16384KB This problem will be judged on Ural.
·
2015-11-01 15:59
ROM
上一页
69
70
71
72
73
74
75
76
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他