Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
36315 | 22级廖思学 | 【S】T4 | C++ | 运行出错 | 36 | 6 MS | 420 KB | 1261 | 2025-02-10 20:35:57 |
#include<bits/stdc++.h> using namespace std; int k,n,m,f[60][60],cnt[200]; string s,t,sub; signed main(){ cin>>k>>s>>t; n=s.length();m=t.length(); s='0'+s;t='0'+t; for(int l=1;l<=m;l++){ for(int r=l;r<=m;r++){//zi chuan sub=t.substr(l,r-l+1);sub='0'+sub; // cout<<"!!!"<<l<<" "<<r<<" "<<sub<<endl; memset(f,0x3f,sizeof(f));f[0][0]=0; for(int i=0;i<=n;i++){ for(int j=0;j<=sub.length()-1;j++){ // cout<<i<<" "<<j<<" "<<s[i]<<" "<<sub[j]<<" "<<f[i][j]<<" "<<f[i-1][j-1]<<endl; if(s[i]==sub[j]&&i>=1&&j>=1){f[i][j]=f[i-1][j-1];} if(s[i]!=sub[j]&&i>=1&&j>=1){f[i][j]=f[i-1][j-1]+1;} if(j>=1){f[i][j]=min(f[i][j],f[i][j-1]+1);} if(i>=1){f[i][j]=min(f[i][j],f[i-1][j]+1);} } } // for(int i=0;i<=n;i++){ // for(int j=1;j<=sub.length()-1;j++)cout<<f[i][j]<<" ";cout<<endl; // } cnt[f[n][sub.length()-1]]++; // if(f[n][sub.length()-1]==2)cout<<sub<<endl; // cout<<endl; } } for(int i=0;i<=k;i++)cout<<cnt[i]<<endl; return 0; }