0
已解决
许嘉耀
新手守护
新手守护
题目链接: 酷町堂:3103
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int minn=1000,maxx=0;
bool t(int n){
if(n==1||n==0){
return false;
}
for(int i=1;i<=sqrt(n);i++){
if(n%i==0){
return false;
}
}
return true;
}
string s;
int a[130];
int main(){
cin>>s;
for(int i=0;i<=s.size()-1;i++){
a[s[i]]++;
}
for(int i=0;i<=122;i++){
if(minn>a[i]&&a[i]!=0){
minn=a[i];
}
if(maxx<a[i]){
maxx=a[i];
}
}
if(t(maxx-minn)){
cout<<"Lucky Word";
}else{
cout<<"No Answer";
}
cout<<endl<<maxx-minn;
return 0;
}
**错误!!!