Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
72777 冯诚阳 字符串包含判断 C++ Accepted 1 MS 280 KB 454 2024-05-12 18:06:04

Tests(10/10):


Code:

# include<iostream> # include<cstring> using namespace std; int main(){ string a,b; int a_len,b_len,s=0; cin>>a>>b; a_len=a.size(); b_len=b.size(); for(int i=0;i<=a_len-b_len;i++){ s=0; for(int j=i;j<a_len;j++){ if(a[j]==b[s]){ s++; if(s==b_len){ cout<<"yes"; return 0; } } else break; } } cout<<"no"; return 0; }