链接:https://codeforces.com/problemset/problem/587/A
Recently, Duff has been practicing weight lifting. As a hard practice, Malek gave her a task. He gave her a sequence of weights. Weight of i-th of them is 2wi pounds. In each step, Duff can lift some of the remaining weights and throw them away. She does this until there's no more weight left. Malek asked her to minimize the number of steps.

Duff is a competitive programming fan. That's why in each step, she can only lift and throw away a sequence of weights 2a1, ..., 2ak if and only if there exists a non-negative integer x such that 2a1 + 2a2 + ... + 2ak = 2x, i. e. the sum of those

Duff正在练习举重,Malek给她一个包含不同重量的序列。每步中,Duff可以选择并丢弃一部分剩余的重量,目标是最小化步骤数。Duff只能在某一步丢弃一个2的幂次和等于另一个2的幂次的重量组合。帮助Duff找出完成任务的最小步骤数。
最低0.47元/天 解锁文章
830

被折叠的 条评论
为什么被折叠?



