import sys n, k = list(map(int, sys.stdin.readline().strip().split())) l = list(map(int, sys.stdin.readline().strip().split())) def judge(l, k): for i in set(l): if l.count(i) == k: return True return False found = False res = 0 while not found: if judge(l, k): print(res) found = True l[l.index(max(l))] -= 1 res += 1 if judge(l, k): print(res) found = True l[l.index(min(l))] += 1 res += 1 但是没通过,不知道咋回事
点赞 评论

相关推荐

今天 09:30
复旦大学 Java
投递美团等公司10个岗位
点赞 评论 收藏
分享
在看牛客的社畜很积极:身高体重那一行信息去掉,学校那一行的信息放上面,找半天都没找到你是哪个学校什么专业的
点赞 评论 收藏
分享
11-03 14:57
西北大学 营销
Belltrix:其实就是每根转动一定的角度
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务