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
POJ 1159 -
Palindrome
优化空间LCS
将原串和其逆序串的最长公共子序列求出来为M..那么2*n-M就是所需要加的最少字符..因为求出的M就是指的原串中"潜伏"的最长回文.. 问题转化为求LCS..但是n最大到5000...裸的LCS需要dp[5000][5000]..显然会爆空间. .而更新的时候之于上一层的数据有关...所以空
·
2015-11-13 11:39
poj
USACO Section 1.2: Dual
Palindrome
s
1 /* 2 ID: leetcod3 3 PROG: dualpal 4 LANG: C++ 5 */ 6 #include <iostream> 7 #include <fstream> 8 #include <string> 9 #include <map> 10 #include <vector>
·
2015-11-13 11:04
USACO
LeetCode: Valid
Palindrome
基本一次过吧,题目没说数字要算进去啊。。 1 class Solution { 2 public: 3 bool check(string t) { 4 for (int i = 0; i < t.size(); i++) { 5 if (t[i] != t[t.size()-1-i]) return false; 6
·
2015-11-13 11:45
LeetCode
【UVa】Partitioning by
Palindrome
s(dp)
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=27&page=show_problem&problem=2549 设w[i,j]为i-j能分割成的最少回文串 f[i]为前i个字符能够分成的最少回文串 w[i,j]=1 当w[i+1,j-1]==1 &a
·
2015-11-13 11:07
partition
USACO Section 1.5: Prime
Palindrome
s
这题的关键点: 1.不能检查是否
palindrome
,否则会TLE 2.检查Prime上限一定为sqrt(x)。
·
2015-11-13 10:04
USACO
Data Structure Linked List: Function to check if a singly linked list is
palindrome
http://www.geeksforgeeks.org/function-to-check-if-a-singly-linked-list-is-
palindrome
/ 这里的reverse可以reverse
·
2015-11-13 10:57
function
LeetCode:
Palindrome
Partitioning II
dfs large没过,看了网上的dp 1 class Solution { 2 public: 3 int minCut(string s) { 4 int n = s.size(); 5 vector<int> C(n+1); 6 vector<vector<bool> > P
·
2015-11-13 10:25
partition
LeetCode:
Palindrome
Partitioning
一次过 1 class Solution { 2 public: 3 bool check(string s) { 4 for (int i = 0; i < s.size(); i++) { 5 if (s[i] != s[s.size()-1-i]) return false; 6 } 7
·
2015-11-13 10:24
partition
LeetCode:
Palindrome
Number
一点小失误,基本一次过吧 1 class Solution { 2 public: 3 bool is
Palindrome
(int x) { 4 // Start
·
2015-11-13 10:24
LeetCode
LeetCode: Longest Palindromic Substring
string.substr(strposstart, length) 1 class Solution { 2 public: 3 string longest
Palindrome
·
2015-11-13 10:09
substring
hdu 4632
Palindrome
subsequence
http://acm.hdu.edu.cn/showproblem.php?pid=4632 简单DP 代码: #include<iostream> #include<cstdio> #include<algorithm> #include<string> #include<cstring> #include<cm
·
2015-11-13 10:24
sequence
hdu 4618
Palindrome
Sub-Array
http://acm.hdu.edu.cn/showproblem.php?pid=4618 直接DP+记忆化 虽然时间复杂度看起来是300^4 但实际执行起来要远远小于这个值 所有可以水过 代码: #include<iostream> #include<cstdio> #include<string> #include<cstring&g
·
2015-11-13 10:16
array
【POJ】3974
Palindrome
http://poj.org/problem?id=3974 题意:求s的最长回文串。(|s|<=1000000) #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <iostream> using
·
2015-11-13 10:12
poj
POJ1159-
Palindrome
转载请注明出处:優YoU http://user.qzone.qq.com/289065406/blog/1300587979 设原序列S的逆序列为S' ,则这道题目的关键在于, 最少需要补充的字母数 = 原序列S的长度 — S和S'的最长公共子串长度这个公式我不证明,不难证剩下的就小意思了,最基础的LCS题。 注意本题空间开销非常大,需要适当的处理手法
·
2015-11-13 09:47
poj
Palindrome
s and Super Abilities
http://acm.timus.ru/problem.aspx?space=1&num=1960 题意:给一个串s,要求输出所有的s[0]~s[i],i<|s|的回文串数目。(|s|<=10^5) #include <bits/stdc++.h> using namespace std; struct PT { static const int nS
·
2015-11-13 08:58
super
leetcode第九题--
Palindrome
Number
Problem: Determine whether an integer is a
palindrome
. Do this without extra space.
·
2015-11-13 08:32
LeetCode
LeetCode Online Judge 题目C# 练习 -
Palindrome
Number
Determine whether an integer is a
palindrome
.
·
2015-11-13 08:09
LeetCode
1054-回文回文!
英语中单词
Palindrome
s指顺读倒读都一样的词语,比如radar,reviver,repaper,deified,rotator。
·
2015-11-13 08:35
回文
11151 - Longest
Palindrome
ProblemD: Longest
Palindrome
Timelimit: 10 seconds A
palindrome
is a string that reads
·
2015-11-13 07:30
long
Prime
Palindrome
Golf
Prime
Palindrome
Golf Do you know how to play Prime
Palindrome
Golf?
·
2015-11-13 07:43
Prim
poj 3280 Cheapest
Palindrome
http://poj.org/problem?id=3280 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #define maxn 2000010 5 using namespace std; 6 7 char str[maxn],ch;
·
2015-11-13 07:03
heap
HDU 3068 最长回文 Manacher算法
Manacher算法是个解决
Palindrome
问题的O(n)算法,能够说是个超级算法了,秒杀其它一切
Palindrome
解决方式,包含复杂的后缀数组。
·
2015-11-13 07:00
HDU
[LeetCode]Valid
Palindrome
Given a string, determine if it is a
palindrome
, considering only alphanumeric characters and ignoring
·
2015-11-13 07:02
LeetCode
[LeetCode]
Palindrome
Number
Determine whether an integer is a
palindrome
. Do this without extra space.
·
2015-11-13 07:18
LeetCode
poj 3280 Cheapest
Palindrome
——DP
先开始想了个错的……唉现在思维还进化地不足啊…… 首先要发现的是添加和删除是一样的,所以我们在选cost的时候只用选delete和add的较小值就可以了。 状态转移方程: if(st[i]==st[j]) dp[i][j]=dp[i+1][j-1]; else if(st[i]!=st[j]) dp[i][j]=max(dp[i+1][j]+cost[st[i]-'a'],dp[i][
·
2015-11-13 06:16
heap
UVA 10739 String to
Palindrome
(dp)
Problem H String to
Palindrome
Input: Standard Input Output: Standard Output Time
·
2015-11-13 06:07
String
[LeetCode]
Palindrome
Partitioning II
Given a string s, partition s such that every substring of the partition is a
palindrome
·
2015-11-13 05:48
partition
[LeetCode]
Palindrome
Partitioning
Given a string s, partition s such that every substring of the partition is a
palindrome
·
2015-11-13 05:47
partition
Palindrome
(最长回文串manacher算法)O(n)
Palindrome
Time Limit:15000MS Memory Limit:65536KB &
·
2015-11-13 04:08
ROM
poj1159
palindrome
(动态规划+滚动数组)
题目信息:
Palindrome
利用动态规划+滚动数组,主要考虑到字符串比较长; 1 //Accepted 296K 688MS 2 #include<iostream>
·
2015-11-13 04:31
动态规划
CC 3-
Palindrome
s(manacher)
传送门:3-
Palindrome
s 题意:求为回文串且能整除3且不前导0的子串个数。
·
2015-11-13 04:33
ROM
poj3974(manacher)
传送门:
Palindrome
题意:给定一个字符串,求最长回文子串。 分析:manach裸题,核心理解mx>i?
·
2015-11-13 04:32
poj
POJ 1159
Palindrome
#include<cstdio> #include<cstring> #include<cstdlib> #define MAXN 5005 #define max(a, b) ( a > b ? a : b) short f[MAXN][MAXN], len; char a[MAXN], b[MAXN]; void r
·
2015-11-13 03:59
poj
HDU 4731 Minimum
palindrome
(找规律)
M=1:aaaaaaaa…… M=2:DFS+manacher, 暴出N=1~25的最优解,找规律。N<=8的时候直接输出,N>8时,头两个字母一定是aa,剩下的以aababb循环,最后剩余<5全部补a,等于5补aabab。 M=3:abcabcabcabc…… #include <cstdio> #include <cstring&g
·
2015-11-13 03:37
HDU
HDU 3856
Palindrome
( Manacher + RMQ + 二分 ) WA!!!
不知道错在哪了,求大神指教!!! 思路:用manacher求出每个以str[i]为中心轴的回文串的长度,RMQ预处理区间最大值,对于每个查询,二分最大回文串长,判定是否可行。 #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm&g
·
2015-11-13 03:25
HDU
UVa 10739 - String to
Palindrome
跟UVa 10453 一个类型的题。 题目:给定一个字符串,可以进行 添加任意一个字符,删除任意一个字符,替换任意位置的一个字符变为任意另一个字符 这三种操作,求使得该字符串变成回文串最少操作步数。 添加一个字符与删除一个字符等效,因此只考虑添加。 递推公式:dp[x][y]代表位置x到位置y的字符串变成回文串的最小操作数 if ( str[x]==str[y] ) dp[x][y] =
·
2015-11-13 03:09
String
UVa 10453 - Make
Palindrome
一直都不太会做这种字符串的动规题,今天看了一份解题报告,才稍微有点明白。 感觉方法跟求最长公共子序列有点像……之前遇到过几个类似的,改天一块整理一下。 ------------------------------------------------------------------- 题目:给定一个字符串,最少添加几个字符,能使它变成一个回文串。 递推公式: dp[x][y]代表从第x
·
2015-11-13 03:08
Make
Palindrome
Number
题目: Determine whether an integer is a
palindrome
. Do this without extra space.
·
2015-11-13 03:32
number
hoj 1004 Prime
Palindrome
s 回文素数
/* 晕,弄少了九位数的那段 据说偶数位的话,除了11是回文素数以外,其他均可被11整除并且是合数, 然后就枚举1位3位5位7位9位数的数,然后判断是否为素数即可 */ #include <iostream> #include <cmath> using namespace std; long long a,b; bool judge(long long
·
2015-11-13 03:12
Prim
poj1159
Palindrome
动态规划
题目:回文是一个对称的字符串,换句话说,这个字符串从左到右读和从右到左读是一样的。给出一个字符串,你要编一个程序,决定要插入的最少的字符个数,使得原字符串成为一个回文。比如,字符串”Ab3bd”中插入2个字符,使得它能变成一个回文("dAb3bAd" 或 "Adb3bdA")。如果插入少于2个字符,将无法产生回文。求最少插入几个字符,使其变成回文字符串 分
·
2015-11-13 03:43
动态规划
[POJ1159
Palindrome
]
[题目来源]:IOI 2000 [关键字]:动态规划 [题目大意]:把一个字符串变成回文串所需的最小步骤。 //===================================================================================================== [分析]:因为回文串的要求是正着读和倒着读是一样的,即把这个字符串倒置后进行
·
2015-11-13 02:22
poj
HDU 4731 Minimum
palindrome
2013 ACM/ICPC 成都网络赛
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=4731 题解:规律题,我们可以发现当m大于等于3时,abcabcabc……这个串的回文为1,并且字典数最小, m等以1时,直接输出n个a, 现在要解决的就是m=2的情况: 通过自己再纸上面写可以得出当n大于等于9时,最大的回文为4,要字典数最小,所以前四个都为a,后面也可以找到一个
·
2015-11-13 02:58
ICPC
USACO Section1.5 Prime
Palindrome
s 解题报告
pprime解题报告 —— icedream61 博客园(转载请注明出处)------------------------------------------------------------------------------------------------------------------------------------------------【题目】 求a
·
2015-11-13 01:05
USACO
USACO Section1.2 Dual
Palindrome
s 解题报告
dualpal解题报告 —— icedream61 博客园(转载请注明出处)------------------------------------------------------------------------------------------------------------------------------------------------【题目】 给
·
2015-11-13 01:58
USACO
[LeetCode#9]
Palindrome
Number
The questions: Determine whether an integer is a
palindrome
. Do this without extra space.
·
2015-11-13 01:24
LeetCode
UVA 401-
Palindrome
s
这是一道关于回文字符串的题,但是加上了镜像,我用了两个函数分别判断一个字符串是不是回文 和镜像,然后用两个flag,最后根据题目的要求来输出结果。 #include<stdio.h>#include<string.h>#include<ctype.h>char *ch = "A 3 HIL JM O 2TUVWXY5";cha
·
2015-11-13 01:32
ROM
LeetCode: Valid
Palindrome
解题报告
Valid
Palindrome
Given a string, determine if it is a
palindrome
, considering only alphanumeric characters
·
2015-11-13 00:20
LeetCode
LeetCode:
Palindrome
Partitioning II 解题报告
Palindrome
Partitioning II Given a string s, partition s such that every substring of the partition
·
2015-11-13 00:58
partition
CF 335B -
Palindrome
区间DP
335B -
Palindrome
题目: 给出一个字符串(均有小写字母组成),如果有长度为100的回文子串,输出该子串。否则输出最长的回文子串。
·
2015-11-13 00:32
ROM
USACO 1.2 Dual
Palindrome
s
Dual
Palindrome
s Mario Cruz (Colombia) & Hugo Rickeboer (Argentina) A number that reads the
·
2015-11-13 00:07
USACO
上一页
64
65
66
67
68
69
70
71
下一页
按字母分类:
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
其他