40分求助QWQ
查看原帖
40分求助QWQ
886208
Atwi_llljx楼主2022/12/26 22:03
#include<bits/stdc++.h>
using namespace std;
string s;
int x[26],g;
bool a1(int x){
	if(x<=1)
		return 0;
	for(int i=2;i<=sqrt(x);i++)
		if(!x%i)
			return 0;
	return 1;
}
int main(){
	cin>>s;
	for(int i=0;i<s.length();x[s[i++]-'a']++);
	for(int i=0;i<26;i++)
		if(!x[i])
			g++;
	sort(x+g,x+26);
	if(a1(x[25]-x[g-1]))
		cout<<"Lucky Word"<<endl<<x[25]-x[g-1];
	else
		cout<<"No Answer"<<endl<<"0";
	return 0;
}
2022/12/26 22:03
加载中...