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
zipper
poj 2192
Zipper
(区间dp)
题目链接:http://poj.org/problem?id=2192 思路分析:该问题可以看做dp问题,同时也可以使用dfs搜索求解,这里使用dp解法; 设字符串StrA[0, 1, …, n]和StrB[0,1, .., m]构成字符串Str[0, 1, … , m + n + 1]; 1)状态定义:dp[i, j]表示字符串StrA[0, 1, …, i-1]和字符串StrB[0, 1
·
2015-10-21 13:34
zip
hdu 4501
Zipper
#include<string.h> #include<iostream> #include<string> using namespace std; string s1,s2,s3; int vist[201][201]; int dfs(int a,int b,int c) { if(s3[c]=='\0') return 1; //
·
2015-10-21 11:17
zip
暑假集训第三周第二阶段搜索 H -
Zipper
H- ZipperTimeLimit:1000MS MemoryLimit:32768KB 64bitIOFormat:%I64d&%I64uSubmit Status Practice HDU1501DescriptionGiventhreestrings,youaretodeterminewhetherthethirdstringcanbeformedbycombiningth
linyuxilu
·
2015-10-18 20:00
POJ-2192
Zipper
-DP-字符串
ZipperTimeLimit:1000MS MemoryLimit:65536KTotalSubmissions:17232 Accepted:6131DescriptionGiventhreestrings,youaretodeterminewhetherthethirdstringcanbeformedbycombiningthecharactersinthefirsttwostrings.
MIKASA3
·
2015-09-22 10:00
dp
C语言
poj
POJ-2192
Zipper
-顺序合成串匹配
ZipperTimeLimit:1000MS MemoryLimit:65536KTotalSubmissions:17283 Accepted:6145DescriptionGiventhreestrings,youaretodeterminewhetherthethirdstringcanbeformedbycombiningthecharactersinthefirsttwostrings.
MIKASA3
·
2015-08-25 16:00
C++
poj
HDU 1501
Zipper
ZipperTimeLimit:2000/1000ms(Java/Other) MemoryLimit:65536/32768K(Java/Other)TotalSubmission(s):23 AcceptedSubmission(s):6Font:TimesNewRoman|Verdana|GeorgiaFontSize:←→ProblemDescriptionGiventhreest
llwwlql
·
2015-08-15 21:00
HDOJ
Zipper
(DFS)
ZipperTimeLimit:2000/1000ms(Java/Other) MemoryLimit:65536/32768K(Java/Other)TotalSubmission(s):2 AcceptedSubmission(s):1ProblemDescriptionGiventhreestrings,youaretodeterminewhetherthethirdstringca
helloiamclh
·
2015-08-07 20:00
hdoj 1501
Zipper
【DFS + 剪枝】
ZipperTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):7761 AcceptedSubmission(s):2742ProblemDescriptionGiventhreestrings,youaretodeterminewhetherthethi
chenzhenyu123456
·
2015-06-16 21:00
POJ-2192(
Zipper
)
DescriptionGiventhreestrings,youaretodeterminewhetherthethirdstringcanbeformedbycombiningthecharactersinthefirsttwostrings.Thefirsttwostringscanbemixedarbitrarily,buteachmuststayinitsoriginalorder. Fo
panjf2000
·
2015-05-11 19:00
POJ - 2192 -
Zipper
(简单DP)
题目传送:
Zipper
思路:设状态dp[i][j]为字符串A前i个字符和B前j个字符能否组成C的前i+j个字符,边界为dp[0][0]=1能则为true,否则falseAC代码:#include #include
u014355480
·
2015-05-04 00:00
dp
ACM
poj
POJ 2192
Zipper
(dp)
链接:http://poj.org/problem?id=2192 题意:就是给定三个字符串A,B,C;判断C能否由AB中的字符组成,同时这个组合后的字符顺序必须是A,B中原来的顺序,不能逆序;例如:A:mnl,B:xyz;如果C为mnxylz,就符合题意;如果C为mxnzly,就不符合题意,原因是z与y顺序不是B中顺序。DP求解:定义dp[i][j]表示A中前i个字符与B中前j个字符是否能组成
u012823258
·
2015-04-08 14:00
dp
HDU 1501
Zipper
ProblemDescriptionGiventhreestrings,youaretodeterminewhetherthethirdstringcanbeformedbycombiningthecharactersinthefirsttwostrings.Thefirsttwostringscanbemixedarbitrarily,buteachmuststayinitsoriginalor
lishuzhai
·
2015-03-17 14:00
搜索DFS
hdu 1501
Zipper
记忆化搜索
ZipperTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):7188 AcceptedSubmission(s):2571ProblemDescriptionGiventhreestrings,youaretodeterminewhetherthethi
u013532224
·
2015-03-09 22:00
dp
DFS
hdu1501——
Zipper
ZipperTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):6906 AcceptedSubmission(s):2496ProblemDescriptionGiventhreestrings,youaretodeterminewhetherthethi
Guard_Mine
·
2014-11-30 20:00
dp
hdu 1501
Zipper
(记忆优化搜索)
判断两个串穿插起来能否变成另外一个串,dfs然后用dp优化下。#include #include #include #include #include #include #include #include #include #include #include #defineB(x)(1a)a=b;} voidcmin(int&a,intb){if(ba)a=b;} voidcmin(ll&a,ll
My_ACM_Dream
·
2014-11-27 20:00
dp
HDU
poj 2192
zipper
今天突然发现我做了这道题,印象不大,但是一看题意感觉很经典,所以决定写一下结题报告首先这道题的题意是给你三个字符串,前两个给你弄一下,然后可以构成一个字符串,但是你要知道这个条件是他们两个组成最后的字符串时不能改变先后顺序得出两个状态方程dp[i][j]表示这个前i个字符和前j个字符是否会构成s3的前i+j个字符(1)dp[i][j]=(dp[i-1][j]&&s1[i]==s3[i+j])?t
u013076044
·
2014-10-01 17:00
Zipper
(HDU 1501) —— DFS
ZipperTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):6850 AcceptedSubmission(s):2468ProblemDescriptionGiventhreestrings,youaretodeterminewhetherthethird
jxust_tj
·
2014-09-19 09:00
DFS
记忆化搜索
HDU-1501
Zipper
DFS+记忆化搜索
HDU-1501ZipperDFS+记忆化搜索 该题理解为将每一个字母与两个模式串进行匹配,如果不符合则回溯进行匹配。一个例子: aaabb aaaaaacdaaaaaacaaabbd到组合串第四个字母时,'a'不能够与A串匹配,于是以状态为A:aaa__,B:a_______,组合串匹配到第五个字母进行递归,......当匹配到组合串的第七个字母'c'时,该字母与A串以及B串的第四个字母均
Enjoying_Science
·
2014-09-15 22:00
优化
字符串
递归
ACM
DFS
A -
Zipper
A- ZipperTimeLimit:1000MS MemoryLimit:65536KB 64bitIOFormat:%I64d&%I64uSubmit StatusDescriptionGiventhreestrings,youaretodeterminewhetherthethirdstringcanbeformedbycombiningthecharactersinthe
u014028231
·
2014-08-11 11:00
POJ 2192
Zipper
ZipperTimeLimit: 1000MS MemoryLimit: 65536KTotalSubmissions: 15938 Accepted: 5651DescriptionGiventhreestrings,youaretodeterminewhetherthethirdstringcanbeformedbycombiningthecharactersinthefirsttwostri
u013263923
·
2014-07-23 18:00
搜索【
Zipper
】
DescriptionGiventhreestrings,youaretodeterminewhetherthethirdstringcanbeformedbycombiningthecharactersinthefirsttwostrings.Thefirsttwostringscanbemixedarbitrarily,buteachmuststayinitsoriginalorder. Fo
u012970471
·
2014-04-25 20:00
ACM-DFS之
Zipper
——hdu1501
ZipperProblemDescriptionGiventhreestrings,youaretodeterminewhetherthethirdstringcanbeformedbycombiningthecharactersinthefirsttwostrings.Thefirsttwostringscanbemixedarbitrarily,buteachmuststayinitsorig
lx417147512
·
2014-04-01 09:00
搜索
ACM
DFS
zipper
hdu1501
hdu 1501
Zipper
(记忆化搜索)
http://acm.hdu.edu.cn/showproblem.php?pid=1501题意:给三个字符串a,b,c,问a,b是否能构成c。a,b的位置是任意的,但其内部是相对有序的。已知c的长度是a,b之和。思路:先是模拟了一遍,感觉不对。看到别人说是记忆化搜索,又去搜了搜记忆化,看了看数塔问题,可以用递推写,也可以递归写,递归时就用到了记忆化,用d[i][j]表示到i行j列为止已经算出结果
u013081425
·
2014-02-28 10:00
dp
HDU 1501
Zipper
地址:http://acm.hdu.edu.cn/showproblem.php?pid=1501题意:给出字符串a,b,c。判断a,b是否同时满足是c的子序列(a,b包含的字母不能重叠)思路:DFS+记忆化搜索。代码:#include #include intmap[405][405];//注意数组大小 chara[201],b[201],c[405]; intlen1,len2,len3,an
u012964281
·
2014-02-18 16:00
C++
c
搜索
ACM
DFS
HDU-1501
Zipper
http://acm.hdu.edu.cn/showproblem.php?pid=1501ZipperTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):5810 AcceptedSubmission(s):2088ProblemDescriptionGi
·
2013-12-16 21:00
zip
POJ2192:
Zipper
(DP)
DescriptionGiventhreestrings,youaretodeterminewhetherthethirdstringcanbeformedbycombiningthecharactersinthefirsttwostrings.Thefirsttwostringscanbemixedarbitrarily,buteachmuststayinitsoriginalorder.For
libin56842
·
2013-12-15 19:00
dp
poj
HDU 1501
Zipper
& ACM俱乐部 2604 单词混合【记忆化搜索】
转载请注明出处:http://blog.csdn.net/a1dark分析:这两题都是一样的、输出有点细微的差别、如果直接暴力搜索的话、会TLE、于是我们需要强力的剪枝、记忆化搜索便是一个比较好的选择、重复的子问题只用计算一遍、大大的节省了结算时间、只需多开一个二维数组记录这个状态是否到达过便可以、当然动态规划也能做这题、毕竟记忆化搜索和动态规划是可以相互转化的#include #include
verticallimit
·
2013-11-23 00:00
字符串
记忆化搜索
带分类android listview控件 demo,欢迎下载学习
参考了网上一些代码http://download.csdn.net/detail/
zipper
9527/6532515
zipper9527
·
2013-11-10 22:00
(字符串模式匹配4.7.10)POJ 2192
Zipper
(判断第3个字符串能否有前两个字符串组成)
/* *POJ_2192.cpp * *Createdon:2013年10月28日 *Author:Administrator */ #include #include #include usingnamespacestd; constintmaxn=210; intmain(){ intt; scanf("%d",&t); intcounter=1; charstr1[maxn],str
caihongshijie6
·
2013-10-28 10:00
动态规划入门——
Zipper
转载请注明出处:http://blog.csdn.net/a1dark分析:这题可以用记忆化搜索来做、由于记忆化搜索和DP是相通的、所以也能用DP来做、相用记忆化搜索做一次、注意标记已经访问过的点、以免重复访问超时、#include #include #defineN205 charstr1[N]; charstr2[N]; charstr3[N*2]; intlen1,len2,len3,ans
verticallimit
·
2013-10-02 22:00
ACM
动态规划入门
TOJ3445
Zipper
Zipper
TimeLimit(Common/Java):1000MS/3000MS MemoryLimit:65536KByteTotalSubmit:24 Accepted:12DescriptionGiventhreestrings
wangwenhao00
·
2013-08-22 22:00
Zipper
Zipper
Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description Given three strings, you are
linxiaoty
·
2013-08-18 08:00
C++
算法
动态规划
HDU 1501 & POJ 2192
Zipper
(dp记忆化搜索)
题意:给定三个串,问c串是否能由a,b串任意组合在一起组成,但注意a,b串任意组合需要保证a,b原串的顺序例如ab,cd可组成acbd,但不能组成adcb。分析:对字符串上的dp还是不敏感啊,虽然挺裸的....dp[i][j]表示a串前i个,b串前j个字母能组成c串前i+j个字母。所以dp[lena-1][lenb-1]=1;就行了。从后往前找就很好找了,从c串最后一个字符开始递归搜索。#incl
paradiserparadiser
·
2013-07-29 14:00
POJ 2192
Zipper
Zipper
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 14193
·
2013-06-30 17:00
zip
HDU 1501
Zipper
动态规划经典
ZipperTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):4884 AcceptedSubmission(s):1742ProblemDescriptionGiventhreestrings,youaretodeterminewhetherthethi
gaotong2055
·
2013-06-26 10:00
HDU 1501
Zipper
动态规划经典
Zipper
Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission
从此醉
·
2013-06-26 10:00
动态规划
HDU 1501
Zipper
ZipperTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):4807 AcceptedSubmission(s):1716ProblemDescriptionGiventhreestrings,youaretodeterminewhetherthethi
fjy4328286
·
2013-05-29 14:00
POJ 2192
Zipper
Zipper
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 14127
·
2013-05-27 09:00
zip
poj2192 | HDU1501 -
Zipper
(最长公共子序列)
ZipperTimeLimit: 1000MS MemoryLimit: 65536KTotalSubmissions: 14117 Accepted: 4958DescriptionGiventhreestrings,youaretodeterminewheth
yew1eb
·
2013-05-25 14:00
-
最长公共子序列
lcs
zipper
poj2192
haskell -
zipper
- use examples: file system and watch the steps
阅读更多wehaveseenthezipperinthepreviouspost,nowwewillseesomeapplicationandexamplesofZippers.firt,wewillexamineasimplefilesystemimplementedwithZipper.typeName=StringtypeData=StringdataFSItem=FileNameData|
joe.bq.wang
·
2013-05-20 22:00
haskell
haskell -
zipper
- use examples: file system and watch the steps
阅读更多wehaveseenthezipperinthepreviouspost,nowwewillseesomeapplicationandexamplesofZippers.firt,wewillexamineasimplefilesystemimplementedwithZipper.typeName=StringtypeData=StringdataFSItem=FileNameData|
joe.bq.wang
·
2013-05-20 22:00
haskell
haskell -
zipper
- use examples: file system and watch the steps
we have seen the
zipper
in the previous post, now we will see some application and examples of Zippers
joe.bq.wang
·
2013-05-20 22:00
haskell
haskell -
zipper
- taking a tree
referential transparency,, one value is as good as another in Haskell if it represents the same thing. e.g. we have to have some way of knowing exactly which five i
joe.bq.wang
·
2013-05-20 17:00
haskell
haskell -
zipper
- taking a tree
阅读更多referentialtransparency,,onevalueisasgoodasanotherinHaskellifitrepresentsthesamething.e.g.wehavetohavesomewayofknowingexactlywhichfiveinourtreewewanttochange.Wehavetoknowwhereitisinourtree.Inimpur
joe.bq.wang
·
2013-05-20 17:00
haskell
haskell -
zipper
- taking a tree
阅读更多referentialtransparency,,onevalueisasgoodasanotherinHaskellifitrepresentsthesamething.e.g.wehavetohavesomewayofknowingexactlywhichfiveinourtreewewanttochange.Wehavetoknowwhereitisinourtree.Inimpur
joe.bq.wang
·
2013-05-20 17:00
haskell
zoj 2401
Zipper
刚开始想着只要遍历2遍第三个串,分别找到第一第二个串的所有字符,事实证明是错了,直到看了dp思想。。。。#include#include#include#defineM205chara[M],b[M],c[2*M];intdp(intx,inty){ intt,f; if(x==-1&&y==-1)return1; t=x+y+1; if(y!=-1&&c[t]==b[y]){ f=
ymrfzr
·
2013-05-04 06:00
dp
ZOJ
USTCOJ 1324
Zipper
判断连续出现字符
以下两份代码采用了hzq(这里)的解题思路。即在输入的a、b、c三个串中,如果c串有连续出现的字符,那么这些字符必定也在a或/和b中连续存在。基于这一思路,能够快速的处理tttttttttttttttttttttttt这样的输入。代码一:递归+连续字符判断。其中45~55的代码写得很漂亮。/* *作者:hzq *修改前代码id:73251 *修改者:lance */ #include #inclu
l03071344
·
2013-05-02 11:00
USTCOJ 1324
Zipper
存储计算结果
在USTCOJ的1324这道题中,当遇到tttttttttttttttttttttttt这样的输入实例时,如下伪代码片段效率非常低。因为有很多的重复计算在里面。可通过存储match函数调用结果减少重复计算。intmatch(char*a,char*b,char*c) { if*c=0 return1 if*a=*b=*c returnmatch(a+1,b,c+1)||match(a,b+1,c+
l03071344
·
2013-04-23 21:00
HDU 1501
Zipper
Zipper
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java
·
2013-03-27 13:00
zip
poj_2192
Zipper
链接:http://poj.org/problem?id=2192和数塔一样,中间存在重复子问题。用一个数组记录是否被访问过,也就是记忆化搜索了。#include #include #include #include #include usingnamespacestd; booldp[205][205]; boolflag; stringsa,sb,sc; voidDFS(inti,intj,
lgh1992314
·
2013-03-17 12:00
上一页
1
2
3
4
下一页
按字母分类:
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
其他