标签:ram 技术 print tar any php tom clu cab
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 9595 Accepted Submission(s): 3923
1 #include <iostream> 2 //#include <cstdio> 3 #include <cstring> 4 #define N 1005 5 using namespace std; 6 int dp[N][N]; 7 string s,ss; 8 int main(){ 9 while(cin>>s>>ss){ 10 int n=s.length(); 11 int m=ss.length(); 12 memset(dp,0, sizeof(dp)); 13 for(int i=1;i<=n;i++){ 14 for(int j=1;j<=m;j++){ 15 if(s[i-1]==ss[j-1]) 16 dp[i][j]=dp[i-1][j-1]+1; 17 else{ 18 dp[i][j]=max(dp[i-1][j],dp[i][j-1]); 19 } 20 } 21 } 22 cout<<dp[n][m]<<endl; 23 } 24 return 0; 25 }
标签:ram 技术 print tar any php tom clu cab
原文地址:http://www.cnblogs.com/zllwxm123/p/7232930.html