百度笔试凉经
# 45 % 公平分配 n = int(input()) baby = list(map(int, input().split())) num = sum(baby) // 2 if sum(baby) % 2 != 0: print('No solution!') else: dp = [0] * (num+1) need = min(baby) number = baby.count(need) dp[need] = number for j in baby: for i in range(need+1, num+1): if i - j >= 0: dp[i] += dp[i - j] ans = dp[-2] // 2 print(ans % (10 ** 9 + 7)) # 55 % 打怪悬赏 n, k = map(int, input().split()) reward = list(map(int, input().split())) ans = 0 reward.sort(reverse=True) jinbi = 0 shang = 0 for i in range(n): if shang < 0 and k > 0: shang = 0 k -= 1 else: jinbi += shang shang += reward[i] print(jinbi)
#百度##笔经#