QAQ 萌新刚学OI 求dalao指教

P2543 [AHOI2004] 奇怪的字符串

@[memset0](/space/show?uid=53495) 帮帮我QAQAQAQAQ
by decoqwq @ 2018-10-06 19:26:48


@[Decoration](/space/show?uid=48265) 作为蒟蒻我帮不了你
by Purple_sword @ 2018-10-06 19:28:13


~~作为AH的OIer,说实话,这种题目没有做的价值~~(逃
by 已注销!$@NM@&7 @ 2018-10-06 19:28:54


刚学oi的都是神仙
by 硫硫硫化氢_ @ 2018-10-06 19:30:20


刚学oi的都是神仙
by p_b_p_b @ 2018-10-06 19:31:30


前排mo AC550dalao
by 硫硫硫化氢_ @ 2018-10-06 19:33:25


OIを勉強したばかりの人はみな神だ
by hhhw @ 2018-10-06 19:40:51


改好了 ```cpp #include<iostream> #include<string> #include<cstring> #include<algorithm> using namespace std; const int maxn=1e4+5; int f[2][maxn]; char s1[maxn],s2[maxn]; int main() { scanf("%s %s",s1+1,s2+1); int len1=strlen(s1+1); int len2=strlen(s2+1); int cur=0; for(int i=1; i<=len1; i++) { cur^=1; std::memset(f[cur],0,sizeof f[cur]); for(int j=1; j<=len2; j++) { if(s1[i]==s2[j]) f[cur][j]=f[cur^1][j-1]+1; else f[cur][j]=max(f[cur^1][j],f[cur][j-1]); } } cout<<f[len1&1][len2]<<endl; return 0; } ```
by codesonic @ 2018-10-06 20:16:34


@[Decoration](/space/show?uid=48265)
by codesonic @ 2018-10-06 20:16:50


|