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
UVA 10453 Make
Palindrome
大意:求一个字符串在通过在任意位置增加一个字符使得变为一个回文串的最小操作数及打印出该回文串。思路:由于增加一个字符不太好操作,我们把问题转换一下。这里需要用到一个结论,即增加字符变为回文串与减少字符变为回文串的最小操作数是相同的,这里可以用手模拟几种情况,就可以得出这个结论。有了这个结论之后,我们就可以来写题了。那么状态转移方程即为:d[i][j]=d[i+1][j-1];str[i]==str
Wall_F
·
2013-01-17 00:00
给定一个链表,怎么判断链表中存储的数据是回文
checkwhetherasinglelinkedlistis
palindrome
.forexample:1->2->1,returnture.and1->2->3->1returnfalse;andcanyouresolveitinlineartime
zzran
·
2013-01-16 17:00
[LeetCode] 回文数字
Palindrome
Number
给你一个正整数,如何判断它是不是回文数字?例如,12344321是回文数字,1234593不是回文数字。方法一:先把原先的数字反转,然后看反转数字和原来的数字是否相等。反转的算法如下:intreverse(intnum){ assert(num>=0);//fornon-negativeintegersonly. intrev=0; while(num!=0){ rev=rev*10+num%10
jiyanfeng1
·
2013-01-16 16:00
UVA 10617 Again
Palindrome
大意不再赘述。思路:有了上一道回文串的题为基础,这一道题便很好思考了。由于只有删除操作,比较方便,所以我们用d[i][j]表示区间i~j内回文串的个数,初始化d[i][i]=1,因为单个字符一定是回文串,而我们开始时,则需要从两个端点开始推。基于删除操作的转移方程:d[i][j]=d[i+1][j]+d[i][j-1]+1;(str[i]==str[j])①d[i][j]=d[i+1][j]+d[
Wall_F
·
2013-01-14 21:00
poj1159
palindrome
(动态规划+滚动数组)
题目信息:
Palindrome
利用动态规划+滚动数组,主要考虑到字符串比较长;1//Accepted296K688MS2#include3#include45usingnamespacestd;6intc
coder_duhg
·
2013-01-10 11:50
动态规划
uva 401
Palindrome
s
Palindrome
s
kg_second
·
2013-01-03 23:00
UVA 401
Palindrome
s String 第一题
传送门 http://openoj.awaysoft.com:8080/judge/contest/view.action?cid=326#problem/A题意是这样的判断回文或者是是否是镜子的字符串(左右对称)#include #include charstr[100]; charm_left[200]={"AMYZO12E3S5HTIUJV8WLX"};//对称的字符序列 charm_rig
yangshuolll
·
2012-12-31 22:00
Poj 1159
Palindrome
题目连接:http://poj.org/problem?id=1159注意:由于c[5000][5000]会爆栈,所以我们要采用滚动数组:使用c[2][5000]来求解:#include #include #include #defineM5010 usingnamespacestd; voidreserve(char*a,char*b) { for(inti=0;i
niuox
·
2012-12-27 23:00
HDOJ1318
Palindrome
s(镜像回文字符串)
我用的是比较笨的办法A的。应该可以用库函数strchr()解决的,但我试了好几次都没成功。所以还是用这个比较保守安全。注意A,F,K,4.......之类的单个字符是回文字符串,而B,E,1,3......之类的单个字符是镜像回文字符串。镜像字符串还必须满足:字符串中所有的字符必须都是镜像字符。比如:E3,EI3,EII3都是镜像字符,而EF3,E33之类的不是镜像字符。即字符串字符个数为单数时中
appte
·
2012-12-24 13:00
Partitioning by
Palindrome
s
constintMAXN(1010); constintINFI((INT_MAX-1)>>1); charstr[MAXN]; inttable[MAXN]; boolis_
palindrome
s
gyarenas
·
2012-12-24 11:00
Calf Flac
CalfFlacItissaidthatifyougiveaninfinitenumberofcowsaninfinitenumberofheavy-dutylaptops(withverylargekeys),thattheywillultimatelyproducealltheworld'sgreat
palindrome
s.Yourjobwillbetodetectthesebovinebea
pucca6
·
2012-12-18 16:00
Dual
Palindrome
s
Dual
Palindrome
sMarioCruz(Colombia)&HugoRickeboer(Argentina)Anumberthatreadsthesamefromrighttoleftaswhenreadfromlefttorightiscalleda
palindrome
.Thenumber12321isa
palindrome
pucca6
·
2012-12-18 00:00
Palindromic Squares
PalindromicSquaresRobKolstad
Palindrome
sarenumbersthatreadthesameforwardsasbackwards.Thenumber12321isatypical
palindrome
.GivenanumberbaseB
pucca6
·
2012-12-18 00:00
如果判断一个32bit整数是个回文整数?
Howtocheckifthebinaryrepresentationofanintegerisa
palindrome
?
jiyanfeng1
·
2012-12-14 04:00
欧拉计划第四题:关于求回文数。第五题,第六题,第七题,第八题,第九题,第十题
第四题:回文数问题Apalindromicnumberreadsthesamebothways.Thelargest
palindrome
madefromtheproductoftwo2-digitnumbersis9009
gaorongchao1990626
·
2012-12-08 14:00
codeforces 245H Queries for Number of
Palindrome
s 区间DP
题意:找特定范围内的回文数量做法:基本的区间DP做法,可惜忘了...#include #include #include #defineLMT5002 usingnamespacestd; boolis[LMT][LMT]; intget[LMT][LMT]; charstr[LMT]; intmain() { intn,l,r,ll; scanf("%s",str); ll=strlen(str
cqlf__
·
2012-12-07 22:00
uva 11584 - Partitioning by
Palindrome
s (dp)
option=com_onlinejudge&Itemid=8&page=show_problem&problem=2631Wesayasequenceofcharactersisa
palindrome
ifitisthesamewrittenforwardsandbackwards.Forexample
Wiking__acm
·
2012-12-07 09:00
[Leetcode] Longest Palindromic Substring
classSolution{ public: stringlongest
Palindrome
(strings){ //StarttypingyourC/C++solutionbelow //DONOTwriteintmain
leo524891010
·
2012-12-05 04:00
打印数字回文
产生N个数字回文1,2,..,9,11,22,..,99,101,....Theorderofthe
palindrome
isonlyrelatedtothe"lefthalf"tothenumberE.g
sunmenggmail
·
2012-11-30 10:00
HDOJ2029
Palindrome
s _easy version 回文数
PostCode:#include usingnamespacestd; intmain(){ intn,p,q; booltest; charstr[100]; scanf("%d",&n); getchar(); while(n--){ test=true; gets(str); for(p=0,q=strlen(str)-1;p<=q;p++,q--){ if(str[p]!=str[q]
appte
·
2012-11-29 22:00
杭电oj
UVa 11151 - Longest
Palindrome
题目:求最常回文子串。分析:dp、LCS,求一个串的最常回文子串就是本串与翻转串之间的最大公共子序列。注意:数据中有空串。#include #include #include charstring[1005]; charrevstr[1005]; intf[1005][1005]; intmain() { intT; while(scanf("%d",&T)!=EOF){ getchar();
mobius_strip
·
2012-11-26 03:00
Queries for Number of
Palindrome
s
这个题老实说算做了一天,,一方面是dp没怎么做,,另一方面还是自己粗心dp有个原则一定是已知推未知!题意是给你一个主串,询问你一个范围的所有回文子串的个数。首先我要先预处理一个is数组,判断i到j这个串是否是回文;然后状态转移,有两种转移方法:1.f[i][j]表示i到j中以i开头的子串的个数;递推关系是:f[i][j]=f[i][j-1]+is[i][j];最后如果要求L到R的子串个数,我就累加
Hhaile
·
2012-11-25 22:00
Codeforces 245H H Queries for Number of
Palindrome
s(DP)
H.QueriesforNumberof
Palindrome
stimelimitpertest5secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYou'vegotastrings
nealgavin
·
2012-11-24 21:00
万内回文数
*版本号:v1.0 *输入描述: *问题描述: *程序输出:万内回文数 *问题分析: *算法设计: */ #include usingnamespacestd; boolis
palindrome
lml58586
·
2012-11-19 16:00
输出10000以内的素数、回文数、回文素数
*作者:李蒙 *完成日期:2012年11月19日 *版本号:v1.0 *输入描述:无 *问题描述:编制一个返回值为bool型的函数isPrimer(), 用于判断参数是否为素数,is
Palindrome
zylmtz2012
·
2012-11-19 07:00
【题目系列】POJ 经典动规10题
【1037】A decorative fence【1050】To the Max【1141】Brackets Sequence【1159】
Palindrome
【1160】Post Office【1163
JarjingX
·
2012-11-18 00:00
动态规划
poj
poj
回文数 素数问题。
*作者:刘同宾 *完成日期:2012年11月16日 *版本号:v1.0 * *输入描述:编制一个返回值为bool型的函数isPrimer(),用于判断参数是否为素数,is
Palindrome
()用于判断参数是否是回文数
liubinzi123
·
2012-11-17 13:00
C++第12周项目4——用函数解决素数、回文数等
blog.csdn.net/sxhelijian/article/details/7910565【项目4-回文、素数】 编制一个返回值为bool型的函数isPrimer(),用于判断参数是否为素数,is
Palindrome
sxhelijian
·
2012-11-16 15:00
POJ1159
Palindrome
Palindrome
TimeLimit: 3000MS MemoryLimit: 65536KTotalSubmissions: 44449 Accepted: 15147DescriptionA
palindrome
isasymmetricalstring
cugbbaoge
·
2012-11-15 21:00
poj
poj
Baoge
Manacher's ALGORITHM: O(n)时间求字符串的最长回文子串
6645824http://zhuhongcheng.wordpress.com/2009/08/02/a-simple-linear-time-algorithm-for-finding-longest-
palindrome
-sub-string
LCL_data
·
2012-11-12 13:00
【ACM】杭电1544:
Palindrome
s
看到这个题第一个想法就是枚举所有的子串,然后再一个一个判断是否回文。显然,在最大串长度足足有5000个字符的情况下,肯定会超时。这时可以用另一种思想:子串为奇数时,以一个字符为中心,依次比较这个字符左边和其对应的右边的字符是否相等,如果相等则说明这是一个回文串。子串为偶数时,比较当前字符跟上一个字符是否相等,然后再向两边拓展,比较。代码如下:#include #include charch[50
tracker_w
·
2012-11-11 21:00
Manacher's ALGORITHM: O(n)时间求字符串的最长回文子串
6645824http://zhuhongcheng.wordpress.com/2009/08/02/a-simple-linear-time-algorithm-for-finding-longest-
palindrome
-sub-string
crazyhacking
·
2012-11-05 13:00
【索引】String
AOAPCI:BeginningAlgorithmContests(RujiaLiu) :: Volume1.ElementaryProblemSolving::String401-
Palindrome
s10010
Ra_WinDing
·
2012-11-01 12:00
HDOJ 2029
Palindrome
s _easy version
第一個思路有問題就是回文的時候是奇數個的情況不同於判斷括號的問題還是用數組寫吧#include #include #include usingnamespacestd; intmain(){ intt; cin>>t; stackmy; chara[100]; while(t--){ cin>>a; for(inti=1;i usingnamespacestd; intmain(){ intt
電泡泡
·
2012-10-29 14:00
poj1159
Palindrome
dp 加最少字符构成回文
Palindrome
TimeLimit:3000MS MemoryLimit:65536KTotalSubmissions:44186 Accepted:15050DescriptionA
palindrome
isasymmetricalstring
qiqijianglu
·
2012-10-19 12:00
String
Integer
input
output
检测回文串
*@params *@return */ publicstaticbooleanis
Palindrome
(Strings){ intlow=0; inthigh=
kavensu
·
2012-10-13 19:00
String
添加字符成为回文字符串
#include #include #include #include #defineLLlonglong usingnamespacestd; chars[10005]; bool
Palindrome
yujuan_Mao
·
2012-10-12 20:00
LeetCode:
Palindrome
Number
Problem:Determinewhetheranintegerisa
palindrome
.Dothiswithoutextraspace.Somehints:Couldnegativeintegersbe
palindrome
s
Tingmei
·
2012-10-06 19:00
找出回文素数
Thenumber151isaprime
palindrome
becauseitisbothaprimenumberanda
palindrome
(itisthesamenumberwhenreadforwardasbackward
天之道
·
2012-09-22 17:00
LeetCode
Palindrome
Number
Palindrome
NumberDeterminewhetheranintegerisa
palindrome
.Dothiswithoutextraspace.Somehints:Couldnegativeintegersbe
palindrome
s
maqingli87
·
2012-09-18 20:00
palindrome
(回文)判断方法
方法1>.使用栈进行判断,将字符串中的每个字符逐个放入栈中,全部放入之后再出栈,根据栈后进先出的特点,将最先出栈的元素与最先进栈的元素进行比较,如果它们相同则继续比较下去(不同则退出比较,说明不是回文),直到所有元素比较一谝或者最后仅剩一个单独元素未被比较,则说明字符串是回文。代码如下:#include #include #include usingnamespacestd; intis_pal
xiaofei2010
·
2012-09-16 09:00
c
list
vector
String
ZOJ 2744
Palindrome
s
#include#include#include#defineMaxn5010chars[Maxn];intlen,num;voidcheck(intl,intr) //中心扩展法{ if(s[l]==s[r]){ num++; while(--l>=0&&++r
Wss0130
·
2012-09-10 22:00
System
扩展
UVaOJ 401 -
Palindrome
s
AOAPCI: BeginningAlgorithmContests(RujiaLiu):: Volume1.ElementaryProblemSolving :: StringDescription给一段字符串,判断是否为回文串或者镜像串。TypeStringAnalysis定义两个指针,一个从前往后,一个从后往前。对两个指针指向的字符进行匹配即可。对于题目给的匹配表,定义个字符常量数组来map
Ra_WinDing
·
2012-09-10 13:00
能够匹配任意长度的回文字的shell脚本 match_
palindrome
.sh
shell脚本文件名:match_
palindrome
.sh内容: [zhang@zhangshibotemp]$vimatch_
palindrome
.sh if[$#-ne2]; then echo"Usage
zhangbest2009
·
2012-09-05 09:00
uva 401 续之 测试用例
鉴于很多同学跟我一样,不停的WA,但是却不知错在哪,我将找到的一些测试用例贴了出来,希望可以帮助你们成功AC NOTA
PALINDROME
--isnota
palindrome
.ISAPALINILAPASI
oceaniwater
·
2012-09-04 10:00
测试
poj 3974
Palindrome
#include #include constintMAX=1000005; charstr[MAX],Manacher_str[2*MAX]; intlen,tc=0,p[2*MAX]; usingnamespacestd; voidchange() { inti; Manacher_str[0]='@'; Manacher_str[1]='#'; for(i=0;ii) p[i]=min(p
yzl_rex
·
2012-08-26 08:00
算法
System
include
Palindrome
Magic 输出n位数的第k个回文串 codechef赛事
http://www.codechef.com/BTCD2012/problems/T02/
Palindrome
MagicProblemcode:T02SubmitMySubmissionsAllSubmissionsInMath-World
hnust_xiehonghao
·
2012-08-25 20:00
list
input
each
output
pair
No.4 The largest
palindrome
made from the product of two 3-digit numbers
The largest
palindrome
made from the product of two 2-digit numbers is 9009 = 91 × 99.
诗意的栖居
·
2012-08-20 17:00
number
UVa 401
Palindrome
s
前几天在做HDU2059龟兔赛跑问题没弄出来,然后干了点别的,今天写了个水题没细心错了好些次不应该。#include //UVa必须加上 #include #include usingnamespacestd; charrev[22]={'A','3','H','I','L','J','M','O','2', 'T','U','V','W','X','Y','5','1','S', 'E','Z'
ReturnZero__
·
2012-08-20 13:00
poj 1159
Palindrome
//这题的题意主要是要求我们求出给出的字符串和其反过来的字符串的最长公共子序列, //然后再用字符串的长度减去其最长公共子序列的长度就可以得出答案了! #include #include #include usingnamespacestd; shortdp[5010][5010]; intmain() { inti,j,len; charstr1[5010],str2[5010]; whil
yzl_rex
·
2012-08-20 09:00
上一页
96
97
98
99
100
101
102
103
下一页
按字母分类:
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
其他