为什么只有50分捏,求助大佬们
查看原帖
为什么只有50分捏,求助大佬们
272309
QODGOD楼主2021/1/24 10:51
#include<bits/stdc++.h>
using namespace std;
char str[1000];
int a[10000];
bool check(int x){
	if(x==0||x==1) return false;
	if(x==2) return true;
	for(int i=2;i<x;i++){
		if(x/i*i==x) return false;
	}
	return true;
} 
int main(){
	
	cin>>str;
	int l=strlen(str);}
	memset(a,0,l);
	for(int i=0;i<l;i++){
		for(int j=0;j<l;j++){
			if(str[i]==str[j]) a[i]++;
		}
	}
	sort(a,a+l);
	int d=a[l-1]-a[0];
	if(check(d)) cout<<"Lucky Word"<<endl<<d;
	else cout<<"No Anser"<<endl<<0;
	
}
2021/1/24 10:51
加载中...