Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
3428 邓小龙 字符串包含判断 C++ Accepted 0 MS 260 KB 706 2024-06-07 20:56:36

Tests(10/10):


Code:

# include<iostream> # include<cstring> using namespace std; string a,b; void fun(){ int lena=a.size(),lenb=b.size(); for(int i=0;i<lena-lenb;i++){ bool f=0;//标记是否包含,==0代表包含 if(a[i]==b[0]){ for(int j=i,k=0;k<lenb;j++,k++){ if(a[j]!=b[k]) {f=1;break;}//f==1代表不包含 } if(f==0){ cout<<"yes"<<endl; return; } } } cout<<"no"<<endl; } int main(){ getline(cin,a); getline(cin,b); //fun(); if(a.find(b)<=(a.size()-b.size())) cout<<"yes"<<endl; else cout<<"no"<<endl; return 0; }