比赛 |
普及水题赛(语言题赛) |
评测结果 |
AAAAAAAAAA |
题目名称 |
笨小猴 |
最终得分 |
100 |
用户昵称 |
c3705 |
运行时间 |
0.018 s |
代码语言 |
C++ |
内存使用 |
0.31 MiB |
提交时间 |
2014-10-16 19:04:19 |
显示代码纯文本
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int zhishu[26];
char s[101];
int a[26];
void zs();
int main()
{
freopen("word.in","r",stdin);
freopen("word.out","w",stdout);
zs();
memset(a,0,sizeof(a));
int maxn=1,minn=100;
int t;
cin.getline(s,100);
int len=strlen(s);
for(int i=0;i<len;i++)
{
a[s[i]-'a']+=1;
if(a[s[i]-'a']>maxn) maxn=a[s[i]-'a'];
}
for(int i=0;i<26;i++)
{
if(a[i]<minn&&a[i]!=0) minn=a[i];
}
t=maxn-minn;
for(int i=0;i<26;i++)
{
if(t==zhishu[i])
{
cout<<"Lucky Word"<<endl;
cout<<t<<endl;
return 0;
}
}
cout<<"No Answer"<<endl;
cout<<"0"<<endl;
return 0;
}
void zs()
{
zhishu[0]=2;
zhishu[1]=3;
zhishu[2]=5;
zhishu[3]=7;
zhishu[4]=11;
zhishu[5]=13;
zhishu[6]=17;
zhishu[7]=19;
zhishu[8]=23;
zhishu[9]=29;
zhishu[10]=31;
zhishu[11]=37;
zhishu[12]=41;
zhishu[13]=43;
zhishu[14]=47;
zhishu[15]=53;
zhishu[16]=59;
zhishu[17]=61;
zhishu[18]=67;
zhishu[19]=71;
zhishu[20]=73;
zhishu[21]=79;
zhishu[22]=83;
zhishu[23]=89;
zhishu[24]=91;
zhishu[25]=97;
}