acgo题库
  • 首页
  • 题库
  • 题单
  • 竞赛
  • 讨论
  • 排行
  • 团队
  • 备赛专区

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
登录
注册
题目详情题解(0)讨论(0)提交记录(0)
  • 不用find函数也可以解

    不用函数也可以啊,速度还挺快的,就是内存消耗的有点多....

    userId_undefined

    xiaoliu

    倔强青铜
    3阅读
    0回复
    0点赞
  • 简单

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

    userId_undefined

    139****8903

    倔强青铜
    3阅读
    0回复
    0点赞
  • 不会find函数怎么办

    没关系你会用substr 写的有点啰嗦,可以删掉一些不必要的判断

    userId_undefined

    Golden_Teeth刷!!

    秩序白银
    1阅读
    0回复
    0点赞
  • 题解

    #include <iostream> #include <string> using namespace std; int main() { string s1, s2; cin >> s1 >> s2; if(s2.find(s1) != stringnpos) { cout << s1 << " is substring of " << s2 << endl; } else if(s1.find(s2) != stringnpos) { cout << s2 << " is substring of " << s1 << endl; } else { cout << "No substring" << endl; } }

    userId_undefined

    把海弄干的鱼

    倔强青铜
    0阅读
    0回复
    0点赞
  • 题解

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

    userId_undefined

    蓝遇return

    倔强青铜
    0阅读
    0回复
    0点赞

共25条

  • 1
  • 2
20条/页
跳至页
首页