Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
118894 | 陈家宝 | 判断子序列 | C++ | 解答错误 | 50 | 0 MS | 300 KB | 371 | 2024-01-02 13:23:26 |
#include<bits/stdc++.h> using namespace std; int a[1001][1001],n,m; string s,s1; int main() { cin>>s>>s1; n=s.size(); m=s1.size(); for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ a[i][j]=max(a[i-1][j],a[i][j-1]); if(s[i-1]=s1[j-1])a[i][j]=max(a[i][j],a[i-1][j-1]+1); } } if(a[n][m]==s.size())cout<<"true"; else cout<<"false"; return 0; }