CodeForces 245C Game with Coins

Two pirates Polycarpus and Vasily play a very interesting game. They have n chests with coins, the chests are numbered with integers from 1 ton. Chest number i hasai coins.

Polycarpus and Vasily move in turns. Polycarpus moves first. During a move a player is allowed to choose a positive integerx (2·x+1≤n) and take a coin from each chest with numbersx, 2·x,2·x+1. It may turn out that some chest has no coins, in this case the player doesn’t take a coin from this chest. The game finishes when all chests get emptied.

Polycarpus isn’t a greedy scrooge. Polycarpys is a lazy slob. So he wonders in what minimum number of moves the game can finish. Help Polycarpus, determine the minimum number of moves in which the game can finish. Note that Polycarpus counts not only his moves, he also counts Vasily’s moves.

,自然而然不想去因为别人的努力而努力,

CodeForces 245C Game with Coins

相关文章:

你感兴趣的文章:

标签云: