不会做,随变打的代码!
  • 板块B2118 验证子串
  • 楼主fifast
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/10/27 12:40
  • 上次更新2024/10/27 14:23:42
查看原帖
不会做,随变打的代码!
1402877
fifast楼主2024/10/27 12:40

错 #3和#5

#include <bits/stdc++.h>
using namespace std;
int main(){
	char s1[210],s2[210];
	cin>>s1>>s2;
	if(strlen(s1)>strlen(s2)){
		cout<<s2<<" is substring of "<<s1;
	}
	else if(strlen(s1)<strlen(s2))cout<<s1<<" is substring of "<<s2;
	else cout<<"No substring";
	return 0;
}

错 #2和#5

#include <bits/stdc++.h>
using namespace std;
int main(){
	char s1[210],s2[210];
	cin>>s1>>s2;
	if(strlen(s1)>strlen(s2)){
		cout<<s2<<" is substring of "<<s1;
	}
	else cout<<s1<<" is substring of "<<s2;
	return 0;
}

有什么区别??

2024/10/27 12:40
加载中...