problem
solution
codes
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int a[30];
int main(){
string str; cin>>str;
for(int i = 0; i < str.size(); i++)
a[str[i]-'a']++;
int minn = 0xffffff, maxn = 0;
for(int i = 0; i < 26; i++){
maxn = max(maxn, a[i]);
if(a[i])minn = min(minn, a[i]);
}
int t = maxn-minn, flag = 1;
if(t == 0 || t == 1)flag = 0;
for(int i = 2; i*i < t; i++)if(t%i==0){
flag = 0; break;
}
if(flag)cout<<"Lucky Word\n"<<t;
else cout<<"No Answer\n"<<0;
return 0;
}
标签:minn,int,NOIP2008,flag,++,笨小猴,maxn,str,Luogu1125
From: https://blog.51cto.com/gwj1314/6043783