5 条题解

  • 0
    @ 2024-7-24 16:54:32

    这题挺水的。(嗯) 首先定义; 输入; 仨if 判断: 1.a是b子串 2.b是a子串 3.都不是 输出就行。(嗯)

    #include<bits/stdc++.h>
    using namespace std;
    string a,b
    int main(){
        cin>>a>>b;
        if(a.find(b)!=-1)
    	    cout<<b<<" is substring of "<<a;
        }
        else if(b.find(a)!=-1){
            cout<<a<<" is substring of "<b;
        }
        else
            cout<<"No substring"<<endl;
        return o;
    }
    
    • @ 2024-7-24 16:58:43

      有坑,注意避雷!!!

    • @ 2024-7-24 17:01:58
      太坑了
      
    • @ 2024-9-8 9:27:49

      正确代码:

      #include<bits/stdc++.h>
      using namespace std;
      string a,b;
      int main(){
          cin>>a>>b;
          if(a.find(b)!=-1)
      	    cout<<b<<" is substring of "<<a;
          }
          else if(b.find(a)!=-1){
              cout<<a<<" is substring of "<<b;
          }
          else
              cout<<"No substring"<<endl;
          return 0;
      }
      

信息

ID
346
时间
1000ms
内存
128MiB
难度
8
标签
递交数
118
已通过
17
上传者