Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:第一次提交c++wa了,然后g++ac。好吧。。。。。贴贴代码In Reply To:第一次提交c++wa了,然后g++ac。好吧。。。。。贴贴代码 Posted by:TSERROF at 2012-10-23 14:08:06 > #include <iostream> > #include <cstring> > using namespace std; > char s1[500],s2[500]; > int res[500][500]; > int main() > { > while(cin>>s1>>s2) > { > memset(res,0,sizeof(res)); > for(int i=0;i<strlen(s1);++i) > for(int j=0;j<strlen(s2);++j) > { > if(s1[i]==s2[j])res[i][j]=res[i-1][j-1]+1; > else res[i][j]=max(res[i][j-1],res[i-1][j]); > } > cout<<res[strlen(s1)-1][strlen(s2)-1]<<endl; > } > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator