问正解
查看原帖
问正解
1053122
shy_lihui楼主2024/10/2 09:59

这个代码WA了两个点

#include<bits/stdc++.h>
using namespace std;
int t,ans=0;
string s;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>t>>s;
	while(t--)
	{
		string x;
		cin>>x;
		int cnt=0;
		if(x.size()==1 && s.size()==1)
		{
			if(s==x)
			{
				ans++;
			}
			continue;
		}
		for(int i=0;i<s.size();i++)
		{
			if(s[i]==x[i])
			{
				cnt++;
			}
		}
		if(cnt>=ceil(floor(x.size()/2)))
        {
            ans++;
        }
	}
	cout<<ans<<'\n';
	if(ans==0)
	{
		cout<<"Good job!";
	}
	else
	{
		cout<<"Make persistent efforts.";
	}
	return 0;
}

2024/10/2 09:59
加载中...