题面:https://oj.nks-oi.top/d/EAGER/p/T1004?tid=673abbf16c69eeaa9addd708
我的TLE代码(60pts):
#include<bits/stdc++.h>
using namespace std;
string s,t;
bool bj(string a,string b){
for(int i=0;i<a.length();i++){
if(a[i]=='?'||b[i]=='?') continue;
else if(a[i]==b[i]) continue;
else return false;
}
return true;
}
int main()
{
cin>>s>>t;
int tlen=t.length();
if(bj(s.substr(s.length()-tlen,tlen),t)) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
for(int x=1;x<=tlen;x++){
string c=s.substr(0,x)+s.substr(s.length()-(tlen-x),tlen-x);
if(bj(c,t)) printf("Yes\n");
else printf("No\n");
}
return 0;
}
有dalao帮忙吗?帮助必关。