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
BUPT 203
Palindrome
后缀数组变了个行就傻眼了。。。前面求出每个点为中心的最长回文字,接着对于一个[l,r]的查询,有两种二分方法第一是left=1,right=r-l+1,mid=(l+r)>>1,对于[l+mid-1,r-mid+1]这个区间用RMQ求出一个最大值P,看他的回文字能否满足,若满足则增加mid值,否则减少第二种是找出[l,r]区间中最长长度的p点,看他的回文字是否满足,若是超出,则比较左区间和右区间长
hqd_acm
·
2011-07-22 16:00
USACO Section 1.5.2 [Prime
Palindrome
s] Java题解
题意分析: 找出a和b间既对称既是素数的数。 解题思路: 用递归去解这题。初始数据为单个的0-9和双数的00-99,扔进递归里每次在两边加0-9再递归,直到过长(大于b的长度)。这样每次递归的参数都可能是要的数值,所以递归方法首先要检查是否满足条件,除了要检查是否是素数、是否在[a,b]之间,还要注意有前导零的是不符合条件的。 素数检查代码,一般不需要写到究极,如下的就可用了。
leonluchen
·
2011-07-15 22:00
java
数据结构
算法
DFS
USACO Section 1.2.5 [Dual
Palindrome
s] Java题解
题意分析:这题和上一题基本是一样的,输出N个大于S的Dual
Palindrome
s。其中N(1<=N<=15),S(0
leonluchen
·
2011-07-08 21:00
java
数据结构
算法
1.3 Calf Flac
We find the biggest
palindrome
in the latter copy, and then fig
格桑花
·
2011-06-18 18:00
C++
c
C#
J#
poj 1159
Palindrome
/*Name:poj1159
Palindrome
Author:UnimenDate:16/05/201118:55Description:最长公共子序列的变形*//*解题报告:参照李鑫ppt:1、对于一个串
Unimen
·
2011-06-18 18:00
Problem 4
The largest
palindrome
made from the product of two 2-digit numbers is 9009 = 91 99.
to_zoe_yang
·
2011-06-12 19:00
em
【水题】USACO Dual
Palindrome
s
进入USACO要注册才能看题: http://train.usaco.org/usacogate 题目:【翻译版、是别处的网站】 http://www.wzoi.org/usaco/13%5C106.asp SAMPLE INPUT (file dualpal.in) 3 25 SAMPLE OUTPUT (file dualpal.out) 26 27 28
基德KID.1412
·
2011-06-11 08:00
C++
c
算法
编程语言
ACM
Problem 004
004:Apalindromicnumberreadsthesamebothways.Thelargest
palindrome
madefromtheproductoftwo2-digitnumbersis9009
光在右边
·
2011-06-06 02:08
python
projecteuler
product
palindrome
Palindromic
Problem 004
004:Apalindromicnumberreadsthesamebothways.Thelargest
palindrome
madefromtheproductoftwo2-digitnumbersis9009
光在右边
·
2011-06-06 02:08
python
product
palindrome
Project
Euler
The Next
Palindrome
TheNext
Palindrome
题目:Apositiveintegeriscalleda
palindrome
ifitsrepresentationinthedecimalsystemisthesamewhenreadfromlefttorightandfromrighttoleft.ForagivenpositiveintegerKofnotmor
格桑花
·
2011-06-04 21:00
J#
Problem 4 求回文数
Apalindromicnumberreadsthesamebothways.Thelargest
palindrome
madefromtheproductoftwo2-digitnumbersis9009
comkingfly
·
2011-06-03 16:00
String
Class
Numbers
POJ1159:
Palindrome
(回文数)
题目和分析过程来自http://www.java3z.com/cwbwebhome/article/article18/report023.html?id=3947回文词是一种对称的字符串。任意给定一个字符串,通过插入若干字符,都可以变成回文词。此题的任务是,求出将给定字符串变成回文词所需要插入的最少字符数。比如“Ab3bd”插入2个字符后可以变成回文词“dAb3bAd”或“Adb3bdA”,但是
randyjiawenjie
·
2011-05-30 17:00
c
String
Class
input
任务
output
Solution of ZOJ 1078
Palindrome
Number
StatementoftheProblemWesaythatanumberisapalindromifitisthesanewhenreadfromlefttorightorfromrighttoleft.Forexample,thenumber75457isapalindrom.Ofcourse,thepropertydependsonthebasisinwhichisnumberisrepre
fduan
·
2011-05-29 19:00
Problem four.
Question: Apalindromicnumberreadsthesamebothways.Thelargest
palindrome
madefromtheproductoftwo2-digitnumbersis9009
jonson
·
2011-05-25 13:00
python
J#
USACO Prime
Palindrome
, SuperPrime Rib
老规矩,先扯几句淡。寻找回文质数还是蛮有趣的。可以先找回文数再判断是否是质数,也可以先找出质数在判断是否满足回文数性质,这些可以认为是搜索的思路。我们知道,但凡问题要求找出全部解的时候,一般都意味着两种思路,即搜索和构造。而通常情况下,搜索耗时会大很多,甚至空间耗费也要大不少,但是搜索的办法思维不复杂,编程简单。构造则相反,通常时空表现都好些,但是编程复杂很多,作为ACMer,应该不怕这个,极致追
fairyroad
·
2011-05-20 00:00
编程
c
优化
回文串
.*; /** * * @author tunzao * @version 1.0 May 6, 2011 * */ public class
Palindrome
s
吞枣
·
2011-05-07 23:11
java
职场
休闲
数组去重 usaco Prime
Palindrome
s
//一个有用的方法就是slt中的unique函数的实现,它基于三个指针,first,last,,result;//其中first指向第一个不和result内的值相等的位置;last作为哨兵位置;;而result作为已经判定不重复点的最后一个位置templateForwardIteratorunique(ForwardIteratorfirst,ForwardIteratorlast){Forwar
xiayang05
·
2011-04-06 09:00
回文写法
boolis_
palindrome
(char*str,intsize){inttmp1=size-2,tmp2=(size-1)/2;for(inti=0;i#include#includeusingnamespacestd
boyhailong
·
2011-03-11 08:00
测试
3.29 tc 的一些感想,Single Round Match 499
比如SingleRoundMatch499的[
Palindrome
Game]950
mindmb
·
2011-03-09 15:00
判断字符串是不是回文
publicclass
Palindrome
{ publicbooleanis
Palindrome
(String[]str){ intlen=str.length; booleanb
songfuyu_1997
·
2011-03-04 17:00
判断回文递归算法实现
staticboolIs
Palindrome
(strings){if(num>=s.Length-num-1){returntrue;}elseif(s[num]==s[s.Length-num-
kntao
·
2011-02-15 17:00
算法
String
POJ-1159-
Palindrome
-回文-动态规划
题意:给定一字符串,问至少插入多少个字符,才能使得其成为“回文”。分析:动态规划求解。设dp[i][j]存储的是字符串i到j之间至少插入的字符数量,其值通过以下方程求得,if(str[i]==str[j]) dp[i][j]=dp[i+1][j-1];else dp[i][j]=min(1+dp[i][j-1],1+dp[i+1][j]);举例解释如下。对于字符串“Ab3bd",其下标为0,1,2
lihao21
·
2011-01-31 22:00
String
存储
动态规划 加最少字符使字符串变回文 POJ 1159 short水过!
Palindrome
Time Limit:3000MS Memory Limit:65536K Total Submissions:33120 Accepted:
thecloud
·
2010-11-30 08:00
动态规划
动态规划 加最少字符使字符串变回文 POJ 1159 short水过!
Palindrome
Time Limit:3000MS Memory Limit:65536K Total Submissions:33120 Accepted:
soboer
·
2010-11-30 08:00
动态规划
USACO 1.5.2 Prime
Palindrome
s
USACO1.5.2Prime
Palindrome
s/**//*ID: lorelei3TASK: pprimeLANG: C++*/#include #include #include #include
小阮的菜田
·
2010-11-09 12:00
USACO 1.2.5 Dual
Palindrome
s
USACO1.2.5Dual
Palindrome
s/**//*ID: lorelei3PROG: dualpalLANG: C++*/#include using namespace std;int IsDual
小阮的菜田
·
2010-11-09 00:00
ZOJ 2000
Palindrome
Numbers
求回文数,不过数据量有点大,不能一个一个检测,需要找出回文数的规律,然后根据规律推,, #include#include#includeintten(intn){inti,sum=1;for(i=1;ia[i]&&n=0;len--)printf("%c",s[len]);}else{printf("%s",s);for(len--;len>=0;len--)printf("%c",s[len])
dangwenliang
·
2010-11-07 13:00
zoj2744_
Palindrome
s
ZOJ2744
Palindrome
s这道题要求出一个长度不大于5000的字符串所有子串中回文字符串的个数。可以用暴力brute-force方法解决,但是会TLE。
blueslee
·
2010-10-13 11:00
A Algorithm Implementation for Longest
Palindrome
Substring Issue
AAlgorithmImplementationforLongest
Palindrome
SubstringIssueHereismysimplerecursiveimplementationforthisissue.Withoutfulltest.Ifanybug
JonsenElizee
·
2010-10-10 23:00
最长回文子串
;importjava.util.List;/***基本思路:将原始串翻转,然后计算这两个串的最长公共子串即为最大的回文数**@authorqibaoyuan**/publicclassLongest
Palindrome
QIBAOYUAN
·
2010-09-21 20:00
String
list
Arrays
Class
input
import
判断字符串是否为回文字符串(Java版)
public class
Palindrome
{ public boolean is
Palindrome
(String[] str) {  
兰博基尼
·
2010-09-12 17:00
java
POJ3280*Cheapest
Palindrome
题解动态规划DP
Cheapest
Palindrome
TimeLimit:2000MS MemoryLimit:65536KTotalSubmissions:2620 Accepted:1294DescriptionKeepingtrackofallthecowscanbeatrickytasksoFarmerJohnhasinstalledasystemtoautomateit.Hehasinstalledone
power721
·
2010-09-04 11:00
USACO Solution Code(5):Name That number, Palindromic Squares and Dual
Palindrome
s
都是比较简单的几道题,就不多废话了,直接上代码。 #include#include#include#include usingnamespacestd; ifstreamfin("namenum.in");ofstreamfout("namenum.out"); //将字母映射到数字,不存在的为-1intmap[]={2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,-1,7,7,8
fairyroad
·
2010-08-30 11:00
c
object
String
header
iterator
pku 1159
Palindrome
使用滚动数组
使用滚动数组 题目:http://acm.pku.edu.cn/JudgeOnline/problem?id=1159 #include#include#definemax5002#defineMAX(x,y)(x>y?x:y)//滚动数组shortg[2][max];charsa[max];charsb[max];intmain(){//freopen("in.txt","r",stdin);i
GoOnDrift
·
2010-08-29 23:00
解题报告PKU1159 最长公共字串 回文串 DP
Palindrome
TimeLimit:3000MS MemoryLimit:65536KTotalSubmissions:31491 Accepted:10509DescriptionA
palindrome
isasymmetricalstring
ACM_DavidCN
·
2010-08-18 15:00
String
Integer
input
output
ural 1297(求最长回文子串,后缀数组)
1297.
Palindrome
TimeLimit:1.0secondMemoryLimit:16MBThe“U.S.Robots”HQhasjustreceivedaratheralarminganonymousletter.Itstatesthattheagentfromthecompeting
xiaotaoqibao
·
2010-08-15 20:00
String
Module
service
Solaris
Security
ini
PKU 1159
Palindrome
PKU1159
Palindrome
问题:http://acm.pku.edu.cn/JudgeOnline/problem?
A Za, A Za, Fighting...
·
2010-08-12 19:00
Reverse and Add 简单题
reverseandadd functionstartswithanumber,reversesitsdigitsandaddsthereversetotheoriginal.Ifthesumisnota
palindrome
付翔的专栏
·
2010-07-23 19:00
My
Palindrome
Algorithm
My
Palindrome
AlgorithmHereisasimple
palindrome
algorithmfromme.Itonlycanmakeajudgeonsingle-bytecharacterstring.Cananybodywritea
palindrome
algorithmforChinesecharacterstring
JonsenElizee
·
2010-07-21 17:00
PKU ACM 1159-
Palindrome
题目来源:http://acm.pku.edu.cn/JudgeOnline/problem?id=1159 解题报告:求一个字符串中至少添加几个字符可以使该字符串变成回文串。也是一道简单的DP,我这里用了备忘录的方法,f[i][j]表示要使字符串的第i个到第j个间的字符串成为回文串至少需要添加的字符的个数,那么有两种情况:第一种,a[i]=a[j],那么f[i][j]=f[i+1][j-1]第二
kindlucy
·
2010-06-20 16:00
String
Integer
ini
input
output
判断字符串是回串(回文字符串)
下面给出代码: public class
Palindrome
{ public static void main(String[] args) { S
sunzhiqiang1984
·
2010-06-10 23:00
面试
USACO chapter 1 section 1.5 Prime
Palindrome
s
USACOchapter1section1.5Prime
Palindrome
sUSER:tianbingtianbing[tbbd4261] TASK:pprime LANG:C++ Compiling
hehexiaobai
·
2010-06-06 21:00
401
Palindrome
s
#include#include#defineSIZE35charkey[]={'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','1','2','3','4','5','6','7','8','9'};charval[]={'A','#',
zzljlu
·
2010-06-01 20:00
Longest
Palindrome
(最长回文子串)
一个序列(字符串)S=a1a2...an的倒置S'为anan-1...a1。而S的子串定义为S中任何连续的一部分,如aiai+1...aj 是S的一个子串,但aiai+2...则不是S的子串。如果一个序列S=S',则S称为回文序列。本文接下来将研究一个有趣的问题:给定一个序列S,找出S中最长的回文子串。 在详细分析各个算法之前,先给出一个概览:简单的暴力算法时间复杂度为 Ɵ(n3)。经过仔细分析,
linulysses
·
2010-05-30 08:00
Algorithm
算法
扩展
extension
n2
pair
UVaOJ 401
Palindrome
s
com_onlinejudge&Itemid=8&category=6&page=show_problem&problem=342 题目大意: 文中规定描述了如下三个概念: 1)“regular
palindrome
lostaway
·
2010-05-13 21:00
用Python解答 ProjectEuler问题(4)
The largest
palindrome
made from the product of two 2-digit numbers is 9009 = 91 99.
ryan.liu
·
2010-04-22 17:00
python
hdu 1513 poj 1159 vijos 1327
Palindrome
hdu1513poj1159vijos1327
Palindrome
http://acm.hdu.edu.cn/showproblem.php?
misschuer
·
2010-04-12 12:00
PKU题目分类
上的题目分类动态规划:1037Adecorativefence、1050TotheMax、1088滑雪、1125StockbrokerGrapevine、1141BracketsSequence、1159
Palindrome
The Way of C++
·
2010-03-07 19:00
UVa 401
Palindrome
s
includeusingnamespacestd;charone[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";chartwo[]="A3HILJMO2TUVWXY51SEZ8";int
palindrome
ACb0y
·
2010-02-22 21:00
String
input
2010
Dual
Palindrome
s(USACO)
/*ID:tianlin2PROG:dualpalLANG:C++*/#include#include#includeusingnamespacestd;boolps(intn,intary){chara[]={'0','1','2','3','4','5','6','7','8','9'};stringb;while(n!=0){b=b+a[n%ary];n=n/ary;}for(intx=0,
cyxcw1
·
2010-02-21 19:00
上一页
98
99
100
101
102
103
104
105
下一页
按字母分类:
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
其他