1148专题

【可撤销贪心 堆】SSL_1148 购物

题意 给出 N N N件商品, K K K张优惠券,每个商品原价为 p i p_i pi​,使用优惠券后价格为 q i q_i qi​,现在有 M M M钱,求出最多能买多少件商品。 思路 开 3 3 3个小根堆,分别放 p i p_i pi​, q i q_i qi​, p i − q i p_i-q_i pi​−qi​,其中 p i − q i p_i-q_i pi​−qi​相当于再花那

PAT 1148 Werewolf - Simple Version (20)

1148 Werewolf - Simple Version (20) (20 分) Werewolf(狼人杀) is a game in which the players are partitioned into two parties: the werewolves and the human beings. Suppose that in a game, player #1 said: