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
Palindromes
2013秋13级预备队集训练习2 --A -
Palindromes
Palindromes
Aregularpalindromeisastringofnumbersorlettersthatisthesameforwardasbackward.Forexample,thestring"ABCDEDCBA"isapalindromebecauseitisthesamewhenthestringisreadfromlefttorightaswhenthestring
u013015642
·
2013-12-27 14:00
【UVaOJ】401
Palindromes
PalindromesAregularpalindromeisastringofnumbersorlettersthatisthesameforwardasbackward.Forexample,thestring "ABCDEDCBA" isapalindromebecauseitisthesamewhent
copica
·
2013-12-25 13:00
Palindromes
401
UvaOJ
UVA - 11584 Partitioning by
Palindromes
题意:输入一个有小写字母组成的字符串,你的任务是将它划分成尽量少的回文串思路:dp[i]代表到第i位的最小值,枚举它的前几位求出最小值,为了方便枚举整个长度我们从str[1]开始输入#include #include #include #include usingnamespacestd; constintMAXN=2000; charstr[MAXN]; intdp[MAXN]; intch
u011345136
·
2013-12-20 18:00
Palindromes
Aregularpalindromeisastringofnumbersorlettersthatisthesameforwardasbackward.Forexample,thestring "ABCDEDCBA" isapalindromebecauseitisthesamewhenthestringisreadfromlefttorightaswhenthestringisreadfromr
u013013910
·
2013-12-11 12:00
编程
C语言
uva--401
Palindromes
题目:
Palindromes
解题思路:判断是否为回文:判断字符串前n/2的第i个字符与第n-1-i个字符是否相同,都相同就是回文;判断是否为mirrored,判断字符串前n/2字符的第n-1-i个字符是否与第
u012997373
·
2013-12-03 20:00
USACO Section 1.2 Dual
Palindromes
/* ID:lucien23 PROG:dualpal LANG:C++ */ #include #include #include #include usingnamespacestd; stringnum2string(intnum,intbaseNum); intmain() { ifstreaminfile("dualpal.in"); ofstreamoutfile("dualpal.
LucienDuan
·
2013-11-25 21:00
Algorithm
C++
USACO
(Problem 36)Double-base
palindromes
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
20131007
·
2013-11-17 21:00
c
欧拉计划
poj 3376 Finding
Palindromes
(扩展kmp+trie)
poj3376FindingPalindromes(扩展kmp+trie)分类: 字符串2013-10-0918:11 89人阅读 评论(0) 收藏 举报扩展kmppoj3376FindingPalindromes(扩展kmp+trie)题意:给出n个字符串,问这n个字符串两两链接(一共有n^2中连接方法),组成的所有的字符串中,有多少个回文串。好题!!!解题思路:对于两个串连接是否是回文串,我
pi9nc
·
2013-10-09 21:00
字符串
poj 3376 Finding
Palindromes
(扩展kmp+trie)
poj3376FindingPalindromes(扩展kmp+trie)题意:给出n个字符串,问这n个字符串两两链接(一共有n^2中连接方法),组成的所有的字符串中,有多少个回文串。好题!!!解题思路:对于两个串连接是否是回文串,我们应该怎样去判断了?假如我们把其中一个翻转,若此时,短的那个串是长的那个的前缀,而长的那个串后面剩余的后缀恰好是个回文串,那这两个串连起来就是个回文串了。比如abc和
No__stop
·
2013-10-09 18:00
扩展kmp
【2029 回文字符串】
Palindromes
_easyversionTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission
lavendermaple
·
2013-09-05 22:00
UVA 11584 Partitioning by
Palindromes
题意:输入一个字符串,把字符串划分成尽量少的回文串。思路:用dp[i]表示前i个字符组成的字符串划分成最少的回文串的个数。那么dp[i]=min{dp[k]+1|0 #include #include #include #include #include #include #include #include #include #include #defineinf0x3f3f3f3f #defin
qian99
·
2013-08-31 20:00
dp
HD2029
Palindromes
_easy version Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others
·
2013-08-28 22:00
UVA 11584 Partitioning by
Palindromes
(回文DP,4级)
A-PartitioningbyPalindromesCrawlinginprocess...CrawlingfailedTimeLimit:1000MS MemoryLimit:0KB 64bitIOFormat:%lld&%lluSubmitStatusAppointdescription:SystemCrawler(2013-05-30)DescriptionProblemH:P
nealgavin
·
2013-08-28 16:00
【索引】String
AOAPCI:BeginningAlgorithmContests(RujiaLiu) Volume1.ElementaryProblemSolving::String401-
Palindromes
10010
u011328934
·
2013-08-07 22:00
zoj2744
Palindromes
字符串的题
题意是求给一个字符串算出其中有多少个回文子串(每个回文子串必须是连续的),关于这题由于数据范围才5000,所以可以用O(N*N)的动态规划去做或者是用暴力的搜索,每次枚举回文串的对称中点复杂度不超过O(N*N),但是用dp做就很蛋疼了,因为内存限制存不了所有的状态,所以得用滚动数组去存,下面将给出几种不同实现的代码。如果暴力枚举中点方法确实很简单,但我还是建议,写一下dp,/可以锻炼一下代码能了,
u011401504
·
2013-08-04 18:00
HDU 1554
Palindromes
(回文串+动态规划)
题意:给定若干字符串,输出每个字符串的回文子串个数,这里回文串在原字符串中必须是连续的。思路:用f(i,j)代表str[i....j]是不是回文串,容易得出递推式f(i,j)=f(i+1,j-1)&&str[i]==str[j],然后将所有的f(i,j)加起来就是答案了。(注意f(i,i)=1和i+1>j-1的情况)但是这个题目开5000*5000的数组会MLE。于是注意到每次f(i,j)只需要用
blzorro
·
2013-08-04 15:00
字符串
动态规划
区间合并
回文串
UVA 11584 Partitioning by
Palindromes
题目大意:给你一个字符串,问你最少能分为几个连续的回文串。思路:简单DP,用d[i]表示从头到i这个位置最少能分为几个,状态方程为d[i]=min(d[j]+1,j #include #include usingnamespacestd; constintINF=0x0fffffff; charstr[1111]; intis(inti,intj) { while(i=0;j--) { if
u010794465
·
2013-08-02 09:00
UVA401 -
Palindromes
题意:判断字符是否是四种情况,1,普通字符串,2,回文字符串,3镜像字符串,4既是回文又是镜像字符串。思路:先判断是否为回文串,再判断是否为镜像字符串,注意要处理0与O之间的关系。#include #include intmain(){ chars[100]; inta,b; while(scanf("%s",s)!=EOF){ b=1,a=1; intlen=strlen(s); for(in
u011345461
·
2013-08-01 20:00
iDual
Palindromes
(枚举)
Dual
Palindromes
Mario Cruz (Colombia) & Hugo Rickeboer (Argentina) A number
Simone_chou
·
2013-08-01 01:00
dual
Palindromic Squares(枚举)
Palindromic Squares Rob Kolstad
Palindromes
are numbers that read the same forwards as backwards.
Simone_chou
·
2013-07-31 17:00
ROM
uva 11584 - Partitioning by
Palindromes
(简单dp)
点击打开链接 题目大意: 给一个字符串, 要求把它分割成若干个子串,使得每个子串都是回文串。问最少可以分割成多少个。 分析: f[i]表示以i结尾的串最少可以分割的串数。 f[i] = min{ f[j]+1, 串[j,i]是回文串&&1<=j<=i } 代码: #include<iostream> #include<cs
king_tt
·
2013-07-31 16:00
partition
hdu 3948 The Number of
Palindromes
后缀数组,求不同回文子串的数量#include #include //hdu3948 constintMAXN=200010; intwa[MAXN],wb[MAXN],ws[MAXN],wv[MAXN]; intrank[MAXN],height[MAXN],r[MAXN],sa[MAXN]; inlineintmin(constinta,constintb){returna=0;--i)sa
solotzg
·
2013-07-28 16:00
杭电 hdu 2029
Palindromes
_easyversion:#include #include usingnamespacestd; #defineN1000 charstr[N]; intmain(){
冷面寒枪
·
2013-07-27 17:48
ACM
HDU
杭电
2029
UVA 11584 Paritioning by
Palindromes
(动态规划 回文)
题目大意:输入一个由小写字母组成的字符串,你的任务是把它划分成尽量少的回文串。比如racecar本身就是回文串;fastcar只能分成7个单字母的回文串;aaadbccb最少可分成3个回文串:aaa、d、bccb。字符串的长度不超过1000。分析:令dp[i]表示从第1个到第i个字符所组成的最少回文串数。我们考虑如果前k个字符构成了1个回文,那么前k+1个字符最多构成2个回文,如果这些字符都相同,
·
2013-07-26 16:00
动态规划
uva 401
Palindromes
(字符串处理)
Palindromes
Aregularpalindromeisastringofnumbersorlettersthatisthesameforwardasbackward.Forexample,
u011328934
·
2013-07-24 23:00
Palindromes
_easy version 2029 hdu
Palindromes
_easyversionTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission
shan614667793
·
2013-07-24 10:00
USACO Section 1.2.5 Dual
Palindromes
又是进制转换的问题,不过有了上一道题的基础,这道题目就简单多了,首先我们有了转换成各种进制的函数,也有了判断回文的函数其他的按照题目叙述来做就好了,不多说,看不懂请到上一道题目中找答案/* ID:zhuihun1 PROG:dualpal LANG:C++ */ #include #include #include usingnamespacestd; stringjinzhi(intn,intx
zhuihunmiling
·
2013-07-23 10:00
USACO 1.2.5 Dual
Palindromes
双重回文数
DualPalindromesMarioCruz(Colombia)&HugoRickeboer(Argentina)Anumberthatreadsthesamefromrighttoleftaswhenreadfromlefttorightiscalledapalindrome.Thenumber12321isapalindrome;thenumber77778isnot.Ofcourse,p
caizi1991
·
2013-07-22 20:00
401 -
Palindromes
UVaOJRoot :: AOAPCI:BeginningAlgorithmContests(RujiaLiu) :: Volume1.ElementaryProblemSolving :: StringAregularpalindromeisastringofnumbersorlettersthatisthesameforwardasbackward.Forexample,thestring "
SIOFive
·
2013-07-08 14:00
算法
String
uva
401 -
Palindromes
题意:判断输入字符串是否为"回文"或"镜像".思路:回文:从首末两端同时向中间进行遍历,若出现不相同的字符,则不是回文;当两个指针相遇时,表示这是回文.镜像:从首末两端同时向中间进行遍历,判断两个字符是否为镜像,若不是镜像字符,则整个字符串不是镜像; 当两个指针相遇时,表示这是镜像.要点:1.使用map来存放各个字符的镜像字符,这样可以通过[]来快速得到一个字符的镜像字符;当[]所取字符不存在时,
sailtseng
·
2013-07-03 21:00
uva
401
Palindromes
9.401 -
Palindromes
本题是比较字符串,判断是回文数还是镜面反射数. 先把满足条件的字符存在一个数组中,在非扩展ASCII码中,char最大127. 用大小为128的数组就够了. intmain() { charC[128]; C['A']='A',C['E']='3',C['H']='H',C['I']='I',C['J']='L',C['L']='J',C['M']='M'; C['O']='O',C[
PandaCub
·
2013-06-23 00:00
String
uva
hdoj 1544
Palindromes
PalindromesTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):1062 AcceptedSubmission(s):460ProblemDescriptionAregularpalindromeisastringofnumbersorletter
y990041769
·
2013-05-18 11:00
light oj 1258 - Making Huge
Palindromes
(KMP)
题目链接题意: 给你一个字符串,在字符串尾部加上一些字符,使这个字符串变成一个回文串(正反读都一样的字符串),求该回文串的最小长度。思路: 在lightoj里这个题目是属于KMP分类的,但乍看好像不是kmp,因为只有一个字符串。要想的到一个回文串,把该字符串翻转接到原串后面必然是一个回文串,但并不一定是最短的。我们必须考虑怎么把两个串尽量融合在一起,这就要看翻转串的前段与原串的后段有多少是
xindoo
·
2013-05-13 20:00
数据结构
KMP
ACM
UVa 11584 - Partitioning by
Palindromes
回文串dp
ProblemH:PartitioningbyPalindromesWesayasequenceofcharactersisa palindrome ifitisthesamewrittenforwardsandbackwards.Forexample,'racecar'isapalindrome,but'fastcar'isnot.A partition ofasequenceofcharact
cyendra
·
2013-04-24 17:00
题解
dp
动态规划
UVa 11584 - Partitioning by
Palindromes
回文串dp
ProblemH:PartitioningbyPalindromesWesayasequenceofcharactersisapalindromeifitisthesamewrittenforwardsandbackwards.Forexample,'racecar'isapalindrome,but'fastcar'isnot.Apartitionofasequenceofcharactersi
cyendra
·
2013-04-24 17:00
动态规划
题解
dp
解题报告
DP
USACO Dual
Palindromes
题解
阅读更多一天水了两题,呵呵,题目确实挺水的做完上一题,这一题已经毫无难度可言了,只改了点代码诸位凑合看:/*ID:bbsunch2PROG:dualpalLANG:C++*/#include#include#include#include#includeusingnamespacestd;stringchangeBase(intformerNum,intbaseNum){stringlatterN
bbsunchen
·
2013-04-23 14:00
USACO
Algorithm
USACO Dual
Palindromes
题解
一天水了两题,呵呵,题目确实挺水的 做完上一题,这一题已经毫无难度可言了,只改了点代码 诸位凑合看: /* ID: bbsunch2 PROG: dualpal LANG: C++ */ #include <iostream> #include <fstream> #include <string> #include <vector&
bbsunchen
·
2013-04-23 14:00
Algorithm
USACO
Dual
Palindromes
DualPalindromesMarioCruz(Colombia)&HugoRickeboer(Argentina)Anumberthatreadsthesamefromrighttoleftaswhenreadfromlefttorightiscalledapalindrome.Thenumber12321isapalindrome;thenumber77778isnot.Ofcourse,p
jimzhai
·
2013-04-20 23:00
【leetcode】Palindrome Number
Some hints: Could negative integers be
palindromes
?
king_tt
·
2013-04-14 12:00
LeetCode
hdu_
Palindromes
_easy version_解题报告
题目出处简单题思路:回文串题。这里有一篇是用递归解回文串。当然可以用循环解题关键代码:intlen=strlen(str); for(i=0;i<len/2;i++){ if(str[i]!=str[len-1-i]){ //dosomething } }
cbs612537
·
2013-03-31 19:00
ACM
HDU
回文串
回文数 2
package com.gaoyuan; public class
Palindromes
{ public static boolean isPalindrome(String s) {
xizhenyin
·
2013-03-31 15:00
回文
USACO Section 1.2 Dual
Palindromes
大意略。/* ID:g0feng1 LANG:C++ TASK:dualpal */ #include #include #include #include #include #include #include #include #include #include usingnamespacestd; ofstreamfout("dualpal.out"); ifstreamfin("dual
Wall_F
·
2013-03-27 08:00
hdu2029――
Palindromes
_easy version
原题: ProblemDescription “回文串”是一个正读和反读都一样的字符串,比如“level”或者“noon”等等就是回文串。请写一个程序判断读入的字符串是否是“回文”。 Input 输入包含多个测试实例,输入数据的第一行是一个正整数n,表示测试实例的个数,后面紧跟着是n个字符串。 Output 如果一个字符串是回文串,则输出"yes",否则输出"no". SampleInput
bingsanchun
·
2013-03-24 00:00
java
开发技术
ZOJ 1325
Palindromes
#include #include #include #include #include #include #include #include #include #include usingnamespacestd; charss[]="E3JLS2Z5AHIMOTUVWXY18"; intslen; boolishave(charc) { for(inti=0;i
lmyclever
·
2013-03-20 13:00
ZOJ 2744
Palindromes
(动态规划)
PalindromesTimeLimit:2Seconds MemoryLimit:65536KBAregularpalindromeisastringofnumbersorlettersthatisthesameforwardasbackward.Forexample,thestring"ABCDEDCBA"isapalindromebecauseitisthesamewhenthestr
·
2013-03-18 16:00
动态规划
ZOJ 2744
Palindromes
区间DP
做法:求出i,j直接的字符是否形成回文。b[i][j]=(b[i+1][j-1])&(str[i]==str[j])#include #include constintLMT=5005; booldp[LMT][LMT]; intans; voidinit(void) { memset(dp,0,sizeof(dp)); ans=0; } intmain(void) { charsec[LMT];
cqlf__
·
2013-03-13 23:00
UVA 401 -
Palindromes
Aregularpalindromeisastringofnumbersorlettersthatisthesameforwardasbackward.Forexample,thestring"ABCDEDCBA" isapalindromebecauseitisthesamewhenthestringisreadfromlefttorightaswhenthestringisreadfromri
hellobinfeng
·
2013-03-11 22:00
UVA 401 -
Palindromes
A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string"ABCDEDCBA"is a palindrome because it is the same when the string
hellobin
·
2013-03-11 22:00
ROM
寒假后续刷题——回文与镜像文
Palindromes
Aregularpalindromeisastringofnumbersorlettersthatisthesameforwardasbackward.Forexample,thestring
hcbbt
·
2013-02-09 12:00
C++
C++
ACM
ACM
刷题
寒假刷题系列
HDT_2029
Palindromes
_easy version
这题是求"回文串",所谓"回文"就是一个字符串正反读来都是一样的,例如:level,noon.在一个for循环里面定义了两个变量:i,j,以前没有用过这种方法,也不知道可不可以用,但事实证明还是可以用的,呵呵以下是代码:#include #include #include #include usingnamespacestd; intmain() { intn,x,i,j,flag; char
hellokatewj
·
2013-02-07 10:00
上一页
6
7
8
9
10
11
12
13
下一页
按字母分类:
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
其他