奇安信笔试
第二题养鹅投资,一直卡在80%
class Solution: def maxIncomeProducts(self, products, months): n = len(products) x_l = [] y_l = [] for i in range(n): x_l.append(products[i].x) y_l.append(products[i].y) ans = [] for i in range(n-1, -1, -1): f, w = months // x_l[i], months % x_l[i] if f >= 1: ans.append(i) months = w return [products[i] for i in range(n) if i in ans]