Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
122850 林嘉乐 字符串包含判断 C++ Compile Error 0 MS 0 KB 743 2025-06-21 16:25:22

Tests(0/0):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ string a; string b; cin>>a; cin>>b; int s=a.length(); for(int i=0;i<=s;i++){ if(s[i]==b[0]){ int flag=1; for(int j=i,k=0;k<b.length();j++,k++){ if(a[j]!=b[k]){ flag=0; break; } } if(flag){ cout<<"yes"<<endl; return 0; } } } cout<<"no"<<endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:14:15: error: invalid types 'int[int]' for array subscript
         if(s[i]==b[0]){
               ^
Main.cc:16:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int j=i,k=0;k