Sprunki_Rabbit @ 2024-09-16 17:38:11
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s;
int list[26] = {};
int prime[25] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
cin >> s;
int maxn = 0,minn = 0;
for(int i=0;i<s.size();i++)
list[s[i]-'a']++;
for(int i=0;i<26;i++)
{
if(list[i] > maxn)
maxn = list[i];
if(list[i] < minn)
minn = list[i];
}
int n = maxn - minn;
for(int i=0;i<25;i++)
{
if(n == prime[i])
{
cout << "Lucky Word" << endl;
cout << n;
return 0;
}
}
cout << "No Answer" << endl;
cout << n;
return 0;
}
by Sprunki_Rabbit @ 2024-09-16 17:42:40
求调
by yinqf @ 2024-09-16 17:44:21
题号?
by Sprunki_Rabbit @ 2024-09-16 17:45:40
@yinqf P1125 [NOIP2008 提高组] 笨小猴
by Sprunki_Rabbit @ 2024-09-16 17:45:49
P1125 [NOIP2008 提高组] 笨小猴
by chenly8128 @ 2024-09-16 18:08:50
错误有3个:
自己改改吧。