社区讨论
过了样例,但wa声一片(悬关)
B3958[GESP202403 四级] 相似字符串参与者 4已保存回复 15
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 15 条
- 当前快照
- 1 份
- 快照标识符
- @m0hracbw
- 此快照首次捕获于
- 2024/08/31 14:22 2 年前
- 此快照最后确认于
- 2025/11/05 00:27 4 个月前
CPP
#include<bits/stdc++.h>
using namespace std;
int t,la,lb;
string a,b;
bool check(){
bool f=0;
for(int i=0;i<min(la,lb);i++){
if(la!=lb&&a[i]!=b[i])
if(a[i+1]!=b[i]&&a[i]!=b[i+1])return 0;
if(f==1&&a[i]!=b[i])return 0;
}
return 1;
}
int main(){
ios::sync_with_stdio(0);
cin>>t;
while(t--){
cin>>a>>b;
la=a.size(),lb=b.size();
if(check())cout<<"similar\n";
else cout<<"not similar\n";
}
return 0;
}
回复
共 15 条回复,欢迎继续交流。
正在加载回复...