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
USACO习题:Dual
Palindromes
和之前一道回文题目差不多,解法还是使用前文的方法。 核心方法参考如下: View Code bool is_palindrome(int num,int base){ int reversed = 0,temp=num; while(temp!=0){ reversed = reversed*base + temp%base; temp/=ba
·
2015-10-31 08:22
USACO
URAL 1960
Palindromes
and Super Abilities(回文树)
题意:给一个字符串,长度不超过10万,问每个前缀的本质不同回文串的个数链接:http://acm.hust.edu.cn/vjudge/problem/visitOriginUrl.action?id=45002解法:这个问题涉及到去重,用manacher似乎并不是那么好做,用后缀数组的话,又会遇到“相同回文串分布在不同位置,所以不好统计“的问题,用回文树的话,就会比较方便。每次将新字符加入回文树
UESTC_peterpan
·
2015-10-30 17:00
数据结构
字符串
回文树
【leetcode】Palindrome Number (easy)
Some hints: Could negative integers be
palindromes
?
·
2015-10-30 14:27
LeetCode
LeetCode:
palindromes
题解
Some hints: Could negative integers be
palindromes
?
·
2015-10-30 14:01
LeetCode
No to
Palindromes
! 构造不含回文子串的串
http://codeforces.com/contest/465/problem/C 给定n和m,以及一个字符串s,s不存在长度大于2的回文子串,现在要求输出一个字典比s大的字符串,且串中字母在一定范围内,并且说同样不存在长度大于2的回文子串。 直接去递归构造即可,从最后一位开始,每次只要判断是否子串中含有回文串,其实仔细想想只要考虑是否存在一个字符和前两个字符中的一个相同即可。不卡
·
2015-10-30 13:14
codeforces
LeetCode - Palindrome Number
Some hints: Could negative integers be
palindromes
·
2015-10-30 13:50
LeetCode
(TOJ3260)
Palindromes
描述
Palindromes
are strings that read the same both forwards and backwards.
·
2015-10-30 13:55
ROM
401
Palindromes
(回文词)
Palindromes
A regular palindrome is a string of numbers or
·
2015-10-30 13:11
ROM
leetcode -- Palindrome Number
Some hints: Could negative integers be
palindromes
?
·
2015-10-30 12:34
LeetCode
Uva401
Palindromes
Palindromes
A regular palindrome is a string of numbers or letters that is the same
·
2015-10-30 11:33
ROM
dp --- Codeforces 245H :Queries for Number of
Palindromes
Queries for Number of
Palindromes
Problem's Link: http://codeforces.com/problemset
·
2015-10-28 08:30
codeforces
USACO: Section 1.5 -- PROB Prime
Palindromes
Source Code The key point is that we should generate the
palindromes
instead of enumerating
·
2015-10-27 16:12
USACO
[LeetCode] Palindrome Number
Some hints: Could negative integers be
palindromes
?
·
2015-10-27 15:54
LeetCode
Leetcode:Palindrome Number 回文数
Some hints: Could negative integers be
palindromes
? (ie, -1) If you are thinking of
·
2015-10-27 14:23
LeetCode
UVa-401
Palindromes
#include<iostream> #include<cstdio> #include<cstring> using namespace std; int main() { string a; while(cin>>a) { int k=a.size(); bool f1=
·
2015-10-27 14:32
ROM
light OJ 1258 - Making Huge
Palindromes
【Manacher】
1258-MakingHugePalindromesPDF(English)StatisticsForumTimeLimit: 1second(s)MemoryLimit: 32MBAstringissaidtobeapalindromeifitremainssamewhenreadbackwards.So,'abba','madam'botharepalindromes,but'adam'isn
liu6886
·
2015-10-26 17:00
lightoj 1258 - Making Huge
Palindromes
【Manacher】
1258-MakingHugePalindromesPDF(English)StatisticsForumTimeLimit: 1second(s)MemoryLimit: 32MBAstringissaidtobeapalindromeifitremainssamewhenreadbackwards.So,'abba','madam'botharepalindromes,but'adam'isn
chenzhenyu123456
·
2015-10-25 13:00
Palindromes
pid=1318
Palindromes
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536
·
2015-10-23 09:31
ROM
codeforce No to
Palindromes
!(枚举)
1 /* 2 题意:给定一个字符串中没有任何长度>1的回文子串!求按照字典序的该串的下一个字符串 3 也不包含长度>1的任何回文子串! 4 5 思路:从最低位进行枚举,保证第i位 不与 第 i-1位和第 i-2位相同就好了!那么因为前边i-1 6 位没有长度>1的回文子串,那么前i位也不会出现!最后将最后边
·
2015-10-23 08:13
code
HDU 1544
Palindromes
(回文子串)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1544 问题分析: 问题要求求出字符串的连续子串中的回文子串个数。首先,需要区分连续子串与子序列的区别。 连续子串为连续的字符组成的字符串;子序列需要满足在子序列中出现的字符的相对顺序与字符串中出现的相对顺序相同。 问题的解法:根据回文子串的长度分为奇数与偶数分为两种可能; 1
·
2015-10-21 13:19
HDU
HDOJ2029
Palindromes
_easy version
Palindromes
_easy version Time Limit: 2000/1000 MS (Java/Others) Memory Limit
·
2015-10-21 12:37
version
UVa_401 -
Palindromes
Palindromes
A regular palindrome is a string of numbers or letters that is the same
·
2015-10-21 11:37
ROM
HDU 2020,2021,2024,2028,2029,2030
29日 09:55:28 // //2020 绝对值排序 //2021 发工资咯:) //2024 C语言合法标识符 //2028 Lowest Common Multiple Plus //2029
Palindromes
_easy
·
2015-10-21 10:53
HDU
Queries for Number of
Palindromes
(区间dp)
题目链接:codeforces245H题目大意:给出一个字符串,询问任意区间内的回文子串的个数。题目分析:定义isPar[i][j]表示区间字符串[i,j]是否是回文,可以通过isPar[i+1][j-1]递推得到。定义dp[i][j]表示及区间[i,j]内的回文子串的个数,转移方程如下:dp[i][j]=dp[i+1][j]+dp[i][j−1]−dp[i+1][j−1]+isPar[i][j]
qq_24451605
·
2015-10-05 09:00
dp
codeforces
USACO 1.5 Prime
Palindromes
(打表查询)
#include #defineDEBUG1 #defineTESTCASES9 #defineABS(x)((x)>0?(x):-(x)) #definePRECISION1e-2 #defineSIZE779 intnums; intprimePalindromes[SIZE]={5,7,11,101,131,151,181,191,313,353,373,383,727,757
tiutiu2011
·
2015-09-25 21:00
素数
质数
USACO
1.5
Palindromes
Prime
USACO 1.2 Dual
PalinDromes
(递归判断回文)
#include #defineDEBUG0 #defineTESTCASES8 intN,S; voidtransform(intnum,intbase,char*str,int*len){ intquotient=0; inti=0; while((quotient=num/base)!=0){ str[i++]='0'+(num%base); num=quotient; } str[i+
tiutiu2011
·
2015-09-10 14:00
递归
USACO
回文
dual
1.2
Palindromes
HDU 2029
Palindromes
_easy version(水~)
Description“回文串”是一个正读和反读都一样的字符串,比如“level”或者“noon”等等就是回文串。请写一个程序判断读入的字符串是否是“回文”Input输入包含多个测试实例,输入数据的第一行是一个正整数n,表示测试实例的个数,后面紧跟着是n个字符串Output如果一个字符串是回文串,则输出”yes”,否则输出”no”SampleInput4levelabcdenoonhahaSamp
V5ZSQ
·
2015-09-08 08:00
【白书之路】401 -
Palindromes
回文串 镜像串
palindrome Aregularpalindromeisastringofnumbersorlettersthatisthesameforwardasbackward.Forexample,thestring "ABCDEDCBA" isapalindromebecauseitisthesamewhenthestringisreadfromlefttorightaswhenthestring
wr132
·
2015-08-30 21:00
401
Palindromes
回文串
白书之路
镜像串
Pig and
Palindromes
求左上角走到右下角是回文的方法数 DP
题意:给一个n*m的格子,每个格子有一个字母,只有向下和向左两种走法,现在要求,从左上角走到右下角,走过的格子的字母是回文的有多少种走法?DP,枚举步数,因为是回文串,所以应该是对称的,步数应该为(n+m)2向下取整,可以知道,以左上角为起点走,走step步,走到的点是固定的,假设从左上角走到(r1,c1)这个点,并且走了step步,那么明显有r1+c1=step+1(由(1,1)走到(r1,c1
CHCXCHC
·
2015-08-29 16:00
dp
回文数
滚动数组
USACO-Section 1.5 Prime
Palindromes
(Miller-Rabin)
描述因为151既是一个质数又是一个回文数(从左到右和从右到左是看一样的),所以151是回文质数。写一个程序来找出范围[a,b](5 #include #include usingnamespacestd; inta,b,num; boolwitness(longlonga,longlongn){ longlongd,x; d=1; inti=ceil(log(n-1.0)/log(2.0))
idealism_xxm
·
2015-08-27 21:00
USACO
miller-rabin
UVA 401
Palindromes
PalindromesTimeLimit: 3000MS MemoryLimit: Unknown 64bitIOFormat: %lld&%lluSubmit StatusDescriptionAregularpalindromeisastringofnumbersorlettersthatisthesameforwardasbackward.Forexample,thestring "ABCD
qq_24653023
·
2015-08-21 14:00
ACM
uva
Codeforces 570E - Pig and
Palindromes
(DP)
状态dp[cnt][x1][y1][x2][y2]表示左边从起点开始走cnt步到x1,y1,右边从终点开始走cnt步到x2,y2的方案数。因为知道cnt和x1,x2的话就能求出y1,y2,所以可以做个空间优化。但是这样还不够,因为cnt状态只和cnt-1状态有关,所以可以用滚动数组。转移方程就是当mp[x1][y1]==mp[x2][y2]时(mp为迷宫):dp[cnt][x1][x2]+=dp[
Baoli1008
·
2015-08-21 10:00
UVA 401-
Palindromes
水题细节也很重要啊。。。Inaddition,aftereachoutputline,youmustprintanemptyline.#include #include #include #include typedeflonglongll; usingnamespacestd; charconst*ch="AEHIJLMOSTUVWXYZ12358"; charconst*re="A3HILJM
Griffin_0
·
2015-08-20 10:00
Primes or
Palindromes
?(打表+暴力枚举)
题目链接:codeforces568A题目大意:给出两个整数p,q,设A=pq,sum1[i]为≤i的素数的个数,sum2[i]为≤i的回文数的个数,问sum1[i]≤A⋅sum2[i]的最大的i是多少题目分析:首先通过线性筛将素数和回文数,然后暴力枚举即可。AC代码:#include #include #include #include #defineMAX2000007 usingnames
qq_24451605
·
2015-08-19 09:00
数论
codeforces
【CF 570E】Pig and
Palindromes
【CF570E】PigandPalindromes三维dp找对应步数的组合数目二三维分别表示离1,1和n,m该步数的回文种类如果吧状态数都存下内存太大开个滚动dp数组(最近刚学的)代码如下:#include #include #include #definemod1000000007 #definelllonglong usingnamespacestd; charstr[501][502];
ChallengerRumble
·
2015-08-18 21:00
dp
Pig and
Palindromes
dp
E.PigandPalindromestimelimitpertest4secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputPeppathePigwaswalkingandwalkedintotheforest.Whatastrangecoincidence!Theforesthastheshapeo
u010422038
·
2015-08-17 17:00
Pig and
Palindromes
(DP)
题目地址:http://codeforces.com/contest/570/problem/E比赛的时候急着睡觉这题没看。。。最显然的一个DP方法是dp[i][x1][y1][x2][y2]表示以s[x1][y1]和s[x2][y2]为第i步分别与s[1][1]和s[n][m]形成的回文串的个数,但是数组大小太大。。这时候可以发现知道步数后,y1和y2可以根据x1,x2来求出来,所以可以优化成d
u013013910
·
2015-08-17 15:00
编程
dp
ACM
算法与数据结构
Uva 401
Palindromes
Uva401PalindromesAregularpalindromeisastringofnumbersorlettersthatisthesameforwardasbackward.Forexample,thestring“ABCDEDCBA”isapalindromebecauseitisthesamewhenthestringisreadfromlefttorightaswhenthest
qq_21120027
·
2015-08-15 21:00
uva
判断一个字符串是否为回文串和镜像串(
Palindromes
)
Aregularpalindromeisastringofnumbersorlettersthatisthesameforwardasbackward.Forexample,thestring "ABCDEDCBA" isapalindromebecauseitisthesamewhenthestringisreadfromlefttorightaswhenthestringisreadfromr
Scarlett_geng
·
2015-08-14 17:00
字符串
uva
hdu 5340 Three
Palindromes
(manachar)
题目链接:hdu5340ThreePalindromes用manachar处理一下,分别找出所有包括起始位置和终止位置的回文串,然后枚举第一个串和第三个串,判断中间剩下的是否是回文。#include #include #include #include usingnamespacestd; typedefpairpii; constintmaxn=50005; /*********mannac
u011328934
·
2015-08-12 22:00
【杂题】CodeforcesRound #315 (Div. 2)569C Primes or
Palindromes
?
题目链接题目大意:令g(x)表示x以内的素数个数,f(x)表示x以内回文数的个数。求最大的x使得g(x) #include #defineLLlonglongint #defineMAXN1200005 usingnamespacestd; LLphi[MAXN],b[MAXN],p,q; intnum[35]; boolflag[MAXN]; booljudge(intx){ intcnt=
cqbztsy
·
2015-08-12 21:00
codeforces
div-2
CodeForces #315 (div1) A.Primes or
Palindromes
?
题目大意:求出最大的n,使得小于等于n的素数的个数 #defineLLlonglong usingnamespacestd; constintN=8000005,mx=8000000; boolnp[N]; intp[N],pcnt,sum[N]; inlineintget(intx){ inty=0; for(intt=x;t;t/=10){ (y*=10)+=t%10; } returnx==
qq919017553
·
2015-08-12 00:00
CF 568A(Primes or
Palindromes
?-暴力判断)
A.PrimesorPalindromes?timelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputRikhailMubinchikbelievesthatthecurrentdefinitionofprimenumbersisobsoleteastheyaretooco
nike0good
·
2015-08-11 16:00
Primes or
Palindromes
? (素数打表 回文数)
RikhailMubinchikbelievesthatthecurrentdefinitionofprimenumbersisobsoleteastheyaretoocomplexandunpredictable.Apalindromicnumberisanothermatter.Itisaestheticallypleasing,andithasanumberofremarkableprope
h1021456873
·
2015-08-11 16:00
Primes or
Palindromes
?-Codeforces Round #315 (Div. 2)
http://codeforces.com/contest/569/problem/Cπ(n) —thenumberofprimesnolargerthan n, rub(n) —thenumberofpalindromicnumbersnolargerthan n. foragivenvalueofthecoefficient A findthemaximum n,suchthat π(n) ≤
viphong
·
2015-08-11 04:00
Primes or
Palindromes
? 素数表 回文数
C.PrimesorPalindromes?timelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputRikhailMubinchikbelievesthatthecurrentdefinitionofprimenumbersisobsoleteastheyaretooco
u010422038
·
2015-08-11 04:00
南邮 OJ 1384
Palindromes
Palindromes
时间限制(普通/Java) : 1000MS/ 3000MS 运行内存限制:81920KByte总提交:69 测试通过:40 比赛描述Writeaprogramthatdeterminesifeachinputstringisapalindrome.Apalindromeisastringthatreadsexactlythesameinbothforw
changshu1
·
2015-08-05 14:00
ACM
Palindromes
南邮OJ
南邮 OJ 1054 回文回文!
英语中单词
Palindromes
指顺读倒读都一样的词语,比如radar,reviver,repaper,deified,rotator。
changshu1
·
2015-08-04 09:00
ACM
回文
南邮OJ
hdu5340--Three
Palindromes
(Mannacer算法)
题目链接:点击打开链接题目大意:给出T个字符串,问每个字符串是不是由三个回文串组成,是输出Yes,否则Non*n的复杂度竟然可以过啊,,,,,,,,用Mannacer直接计算出以每一位为中心的最长回文串,然后求出pre[i](1~i)是否为回文串,suf[i](i~len-1)是否为回文串,然后枚举第二段回文串的中点,只要在第二段中左侧和右侧存在同样位置的两个pre[j]和suf[j]为1,那么就
u013015642
·
2015-08-03 09:00
HDU 5340 Three
Palindromes
( 折半枚举+Manacher+记录区间 )
ThreePalindromesTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/65536K(Java/Others)TotalSubmission(s):809 AcceptedSubmission(s):240ProblemDescriptionCanwedividedagivenstringSintothreenonemp
kalilili
·
2015-08-02 20:00
上一页
4
5
6
7
8
9
10
11
下一页
按字母分类:
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
其他