今晚ABC B题求调
  • 板块灌水区
  • 楼主Xin_Ting
  • 当前回复4
  • 已保存回复4
  • 发布时间2024/10/1 20:43
  • 上次更新2024/10/2 00:28:05
查看原帖
今晚ABC B题求调
1332851
Xin_Ting楼主2024/10/1 20:43
#include<bits/stdc++.h>
using namespace std;
int n;
string s;
string a;
int ans=0;
bool check(string a,int len){
    int m=0;
    for(int i=1;i<=len;i++){
        if(a[i]==s[i]){
            m++;
        }
     }
    if(m>=ceil(len/2)){
        return true;
    }
    return false;
}
int main(){
    cin>>n>>s;
    int len=s.length();
    s=' '+s;
    for(int i=1;i<=n;i++){
        cin>>a;
        a=' '+a;
        if(check(a,len)){
            ans++;
        }
    }
    if(ans==0){
        cout<<0<<endl;
        cout<<"Good job!";
    }else{
        cout<<ans<<endl;
        cout<<"Make persistent efforts.";
    }
    return 0;
}

https://www.luogu.com.cn/problem/T515071?contestId=126344

2024/10/1 20:43
加载中...