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
USACO 1.2 Palindromic Squares
Palindromic Squares Rob Kolstad
Palindrome
s are numbers that read the same forwards as backwards.
·
2015-11-13 00:06
USACO
Mnemonics and
Palindrome
s(DP)
链接 先初始化一下所有的回文串 再O(n*n)DP 输出路径dfs 刚开始存所有回文 ME了 后来发现用不着 改了改了OK了 数据还挺强 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 #
·
2015-11-13 00:28
ROM
poj3280Cheapest
Palindrome
(记忆化)
链接 真的1A了。。 一开始想复杂了 想着补全再删 没想好 后来想到递归 大的回文串是由小的推过来的 一直递归下去 对于当前的i,j可以选择保留或者删除 选个最小的 1 #include <iostream> 2 #include<cstring> 3 #include<algorithm> 4 #include<
·
2015-11-13 00:14
heap
hdu4632
Palindrome
subsequence
http://acm.hdu.edu.cn/showproblem.php?pid=4632 TLE了N次 原因居然是取模次数太多了。。! 这数据卡的好紧 还是我写的太搓。。828ms挤过 s[i]==s[j] dp[i][j] = dp[i][j-1]+dp[i+1][j]+1; else dp[i][j] = dp[i][j-1]+d[[i+1][j]-dp[i+1
·
2015-11-13 00:50
sequence
【leetcode】
Palindrome
Partitioning II
Palindrome
Partitioning II Given a string s, partition s such that every substring
·
2015-11-13 00:29
partition
【leetcode】
Palindrome
Partitioning
Palindrome
Partitioning Given a string s, partition s such that every substring of
·
2015-11-13 00:17
partition
[URAL1297
Palindrome
]
[关键字]:后缀数组 字符串 [题目大意]:求出给定字符串的最长回文串。 //======================================================================== [分析]:首先把字符串反转(T')接到原串(T)后边中间用‘~’分割(大于所有字符串中元素就行),最后用'$'结束(小于所有字符)。然后枚举T串中的每一个位置i找到T'中
·
2015-11-13 00:21
ROM
URAL 1297
Palindrome
(Manacher)
The “U.S. Robots” HQ has just received a rather alarming anonymous letter. It states that the agent from the competing «Robots Unlimited» has infiltrated into “U.S. Robotics”. «U.S.
·
2015-11-13 00:15
ROM
【HDU4632
Palindrome
subsequence】区间dp
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4632 题意:给你一个序列,问你该序列中有多少个回文串子序列,可以不连续。 思路:dp[i][j]表示序列i到j中具有的回文串序列数。 当s[i]==s[j], dp[i][j]=dp[i+1][j]+dp[i][
·
2015-11-12 23:42
sequence
LeetCode_Valid
Palindrome
Given a string, determine if it is a
palindrome
, considering only alphanumeric characters and ignoring
·
2015-11-12 23:25
LeetCode
LeetCode_
Palindrome
Partitioning II
Given a string s, partition s such that every substring of the partition is a
palindrome
.
·
2015-11-12 23:12
partition
LeetCode_
Palindrome
Partitioning
Given a string s, partition s such that every substring of the partition is a
palindrome
.
·
2015-11-12 23:11
partition
LeetCode_
Palindrome
Number
Determine whether an integer is a
palindrome
. Do this without extra space.
·
2015-11-12 23:10
LeetCode
LeetCode
Palindrome
Partitioning
链接: https://oj.leetcode.com/problems/
palindrome
-partitioning/ dp+dfs 求字符串s的所有分割,使得每一个子串都是回文字符串.
·
2015-11-12 23:07
partition
LeetCode Problem 9:
Palindrome
Number回文数
描述:Determine whether an integer is a
palindrome
. Do this without extra space.
·
2015-11-12 23:07
LeetCode
Palindrome
http://poj.org/problem?id=1159 最少需要补充的字母数=x的长度-x和y的最长公共子序列的长度。 状态的转移方程: if(i==0||y==0) dp[i][j]=0; else if(x[i]==y[j]) dp[i][j]=dp[][i-1][j-1]+1; else dp[i][j]=max(dp[i-1][j],dp[i][j-1]); 1
·
2015-11-12 23:48
ROM
URAL 1297
Palindrome
最长回文子串
POJ上的,ZOJ上的OJ的最长回文子串数据量太大,用后缀数组的方法非常吃力,所以只能挑个数据量小点的试下,真要做可能还是得用manacher。贴一下代码 两个小错,一个是没弄懂string类的substr的用法是S.substr(i,len)从i开始的长度为len的一段。另外一个是RMQ的时候,询问rk[i],rk[j]的最长前缀应该是等效于求lcp[rk[i]] lcp[rk[j
·
2015-11-12 22:46
ROM
POJ 1159,
Palindrome
3000MS Memory Limit: 65536KTotal Submissions: 26714 Accepted: 8915 DescriptionA
palindrome
·
2015-11-12 22:52
poj
POJ1159(
Palindrome
)
题目链接 题目大意,给定一个字符串,求至少需插入多少字符使其变成回文。动态规划题。 #include <stdio.h>#include <memory.h>#include <string.h> #define MIN(a,b) ((a)<(b)?(a):(b)) #define N 5001 char s[N]; int c[N]; int ma
·
2015-11-12 22:50
poj
[LeetCode#125]Valid
Palindrome
The problem: Given a string, determine if it is a
palindrome
, considering only alphanumeric characters
·
2015-11-12 22:18
LeetCode
回文判断
代码 #include < iostream > using namespace std; bool is
Palindrome
·
2015-11-12 22:50
判断
Java [leetcode 9]
Palindrome
Number
问题描述: Determine whether an integer is a
palindrome
. Do this without extra space.
·
2015-11-12 22:50
LeetCode
LeetCode:
Palindrome
Partitioning 解题报告
Given a string s, partition s such that every substring of the partition is a
palindrome
.Return all possible
·
2015-11-12 22:16
partition
uva 10453 - Make
Palindrome
(dp)
题目链接:10453 - Make
Palindrome
题目大意:给出一个字符串,通过插入字符使得原字符串变成一个回文串,要求插入的字符个数最小,并且输出最后生成的回文串。
·
2015-11-12 21:57
Make
leetcode--
Palindrome
Partitioning
1.题目描述 Given a string, determine if it is a
palindrome
, considering only alphanumeric characters
·
2015-11-12 21:42
partition
leetcode—
Palindrome
解题报告
1.题目描述 Given a string s, partition s such that every substring of the partition is a
palindrome
.
·
2015-11-12 21:39
LeetCode
USACO Calf Flac
heavy-duty laptops (with very large keys), that they will ultimately produce all the world's great
palindrome
s
·
2015-11-12 19:21
USACO
leetcode--
Palindrome
Number
1.题目描述 Determine whether an integer is a
palindrome
. Do this without extra space.
·
2015-11-12 17:31
LeetCode
UVa 10453 Make
Palindrome
(简单DP)
题意: 给定一个字符串,问最少插入多少个字符使其变成回文字符串,并输出。 思路: 题目已经是司空见惯了,关于回文串的输出无非就是递归。 #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> using namespace std;
·
2015-11-12 17:19
Make
UVa 10617 Again
Palindrome
(经典回文串区间DP)
题意: 给定一个字符串s,对s进行删除操作,使得剩下的子串是回文字符串,问最多有多少种这种子串。 思路: 涉及到回文字符串,首先要想到的肯定是区间DP,如何写出状态转移方程? 直接从题意切入:dp[i, j]表示区间[i, j]最多有多少个这样的子串。 1. s[i] == s[j] 去掉s[i],则一个子问题就是dp[i+1, j],去掉s[j],另一个子问题就是dp[i, j-1]。
·
2015-11-12 17:16
ROM
UVa 10739 String to
Palindrome
(经典回文串区间DP)
题意: 给定一个字符串,可以对其进行删除,插入,替换操作。 问最少经过几次操作,可以使这个字符串变成回文字符串。 思路: 类似于以前的只能进行插入/删除操作的回文字符串,这次多了一个替换操作,于是就有了下面的几种情况: (区间DP即是不断向两侧扩大规模) 1. s[i] == s[j] 显然只需要考虑i与j之间的字符串即可,此时dp[i][j] = dp[i+1][j-1]。 2.
·
2015-11-12 17:14
String
UVA 11584 Partitioning by
Palindrome
s 动态规划 入门
这个题目的大意就是,给你一个字符串,然后让你求出最少的回文数。我开始傻逼了,写了一个o(n^3)的算法,结果老超时。然后略看了别人的题解,才知道有个如此的转移方程。 f[i+1]=min(f[j]+1,其中j~i是回文),基础的动态规划题目,还得多多加强训练。 #include<iostream> #include<cstdio> #include<cstring
·
2015-11-12 16:37
partition
UVA 11584 Partitioning by
Palindrome
s
题意:把字符串划分成尽量少的回文串。 dp[i] = max{dp[j-1] + 1 | str[j....i]为回文串}。 View Code 1 /* 2 Author:Zhaofa Fang 3 Lang:C++ 4 */ 5 #include <cstdio> 6 #include <cstdlib> 7 #include &
·
2015-11-12 16:45
partition
No to
Palindrome
s!
http://codeforces.com/contest/465/problem/C 题意:给你一个字符串,然后按照字典序找出下一个字符串,这个字符串中不能含有长度大于等于2的子串为回文串,如果含有输出,否则输出NO; 思路:判断回文串时只需判断要修改的i位置,i+1位置和i+2位置是不是与这个要修改的字符相等。字符串的前缀不含有回文子字符串,改变i位后也不会含有。 1 #inc
·
2015-11-12 16:35
codeforces
POJ-1159-
Palindrome
-dp
给一个长度为5000的串找出最少插入多少个字符得到一个回文串思路1:把该串和其逆序求一遍LCS. 答案就是len-lcs思路2:dp if(tm[i]==tm[j]) dp[i][j]=dp[(i+1)][j-1]; else dp[i][j]=min(dp[(i+1)][j],dp[i][j-1])+1; 可用dfs或者for循环由于内存太大,用dfs不好用上滚动数组。。。dfs版本#inc
viphong
·
2015-11-12 16:00
Valid
Palindrome
Given a string, determine if it is a
palindrome
, considering only alphanumeric characters and ignoring
·
2015-11-12 16:33
ROM
Palindrome
Partitioning II
Given a string s, partition s such that every substring of the partition is a
palindrome
·
2015-11-12 16:19
partition
Palindrome
Partitioning
Given a string s, partition s such that every substring of the partition is a
palindrome
·
2015-11-12 16:18
partition
Palindrome
Number
Determine whether an integer is a
palindrome
. Do this without extra space.
·
2015-11-12 16:55
number
UVA 11151 - Longest
Palindrome
尽管很容易,还是贴出来吧。 #include<stdio.h> #include<string.h> int n, f[1000][1000], len; char s[1010]; void solve() { memset(f,0,sizeof(f)); for(int i = 0; i < len; i ++)
·
2015-11-12 15:02
long
UVA 10617 - Again
Palindrome
这道题因为那个score out给我蒙住了,其实说白了,就是给你一串字符串,让你从中找出有多少回文字串,这个回文字串可以是一个字母,也可以是多个。 既然是动态规划题:我们肯定要这样想,让我们求长度为len的字符串有多少回文字串,那么长度为len-1的字符串有多少回文子串呢,如果我们求出了len-1的字符串,那么长度为len的字符串的回文字串的个数可不可以通过这个来求出呢,那么长度为len-1的母
·
2015-11-12 15:55
ROM
UVA 10739 - String to
Palindrome
由于添加字母和删除字母的效果是一样的,因此我们这里就只进行删除和替换操作。 用f【i】【j】表示将第i到j之间的字串变成回文串的最小操作步数,然后转移方程为当s【i】!=s【j】时,f【i】【j】 = min( f【i+1】【j】 ,f【i】【j-1】,f【i+1】【j-1】)+1;当相等时f【i】【j】 =f【i+1】【j-1】;递归操作更方便; #include<stdio.h&g
·
2015-11-12 15:52
String
UVA 401 -
Palindrome
s
这道题憋了好久,题很简单,错在了输出格式:每行之间有空格 judge后wrong answer,值得注意。 #include<stdio.h>#include<string.h>char s[25];int palin(char* s){ int len = strlen(s); for(int i = 0; i < len/2; i ++)
·
2015-11-12 15:26
ROM
Palindrome
Number
Determine whether an integer is a
palindrome
. Do this without extra space.
·
2015-11-12 14:35
number
Valid
Palindrome
Given a string, determine if it is a
palindrome
, considering only alphanumeric characters and ignoring
·
2015-11-12 14:23
ROM
Prime
Palindrome
s
题目大意:求出区间[a,b]之间的回文质数。 a<=b<=10^8; 解题过程: 1.先打个素数表,新学了个 欧拉筛法,是对普通筛法的改进。普通筛法是每找到一个素数,就把它的所有倍数标记成1,那么对于一个合数,它会被它的所有质因数标记一次。那么就浪费了时间(复杂度O(NloglogN))。欧拉筛法的复杂度可以降到O(N), 它的优化在于 找到一个质数的时候,把所有
·
2015-11-12 14:28
Prim
usaco1.52Prime
Palindrome
s
dfs搜前5位数 根据前面的算后面的 View Code 1 /* 2 ID: your_id_here 3 PROG: pprime 4 LANG: C++ 5 */ 6 #include <iostream> 7 #include<cstdio> 8 #include<cstring>
·
2015-11-12 14:48
USACO
USACO1.24Calf Flac
heavy-duty laptops (with very large keys), that they will ultimately produce all the world's great
palindrome
s
·
2015-11-12 14:29
USACO
POJ 1159
Palindrome
最少需要补充的字母数 = 原序列S的长度 — S和S'的最长公共子串长度 #include <cstdio> #include <cstring> #define Max(a,b) (a)>(b)?(a):(b) const int maxn = 5000 + 10; char s1[maxn], s2[maxn]; s
·
2015-11-12 13:11
poj
数学题(找规律)-hdu-4371-Minimum
palindrome
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4731 题目大意: 给一个n表示有n种字母(全部小写),给一个m,求一个由不超过n种字母组成的m个小写字母的串S,使得S在所有的满足要求的串中最长的回文子串长度最短。 解题思路: 显然当n>=3时肯定是abcabc这样构造。 当n=1时为aaaaaa... 当n=2时,打表可以发
·
2015-11-12 13:11
HDU
上一页
65
66
67
68
69
70
71
72
下一页
按字母分类:
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
其他