题解 | 笨小猴

笨小猴

https://www.nowcoder.com/practice/17865bc2a75c4944a872ef709958c56e

from math import ceil
inp = list(input())
def test(i):
    a = inp.copy()
    while i in a:
        a.remove(i)
    return len(inp) - len(a)
max = 0
min = len(inp)
for i in set(inp):
    c = test(i)
    if c>max:
        max = c
    if c<min:
        min = c
ans = max-min
if ans>2:
    for j in range(2,ceil((ans**0.5))):
        if ans%j==0:
            print('No Answer')
            print(0)
            break
    else:
        print('Lucky Word')
        print(ans)
elif ans==2:
    print('Lucky Word')
    print(ans)
else:
    print('No Answer')
    print(0)

全部评论

相关推荐

不愿透露姓名的神秘牛友
今天 13:47
点赞 评论 收藏
分享
zYvv:双一流加大加粗再标红,然后广投。主要是获奖荣誉不够,建议开始不用追求大厂,去别的厂子刷下实习。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务