| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 112070 | 毛泓博(做题专用,大号Fess) | 最长公共子序列 | C++ | Runtime Error | 0 | 0 MS | 92 KB | 482 | 2023-11-25 09:58:28 |
#include<bits/stdc++.h> using namespace std; string a,b; int dp[10000][10000],sa,sb; int main() { cin>>a>>b; sa=a.length(); sb=b.length(); for(int i=1;i<=sa;i++) { for(int j=1;j<=sb;j++) { if(a[i-1]==b[j-1]) dp[i][j]=dp[i-1][j-1]+1; else if(dp[i-1][j]>dp[i][j-1]) dp[i][j]=dp[i-1][j]; else dp[i][j]=dp[i][j-1]; } } for(int i=1;i<=sa;i++) { for(int j=1;j<=sb;j++) cout<<dp[i][j]<<' '; cout<<endl; } cout<<dp[sa][sb]; return 0; }