303566: CF690A1. Collective Mindsets (easy)

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Collective Mindsets (easy)

题意翻译

有 $n$ 个海盗被编号为 $1\sim n$,并且他们都是绝对理智的,并且他们都知道他们都是绝对理智的,等等。 现在他们要分一些金币。从编号 $1$ 的海盗开始,每个人依次提出一个分配方案,接下来所有人(包括提出方案的人)选择赞成或者反对此方案,如果有至少一半人(恰好一半也行)赞成则通过此方案,否则将这个人杀死并由下一个继续提出分配方案。 每个海盗的第一目标都是保命,其次是拿到更多的金币,再其次是杀掉更多的人。 现在你编号为 $1$ 的海盗,求金币数至少为多少时,你可以在**活下来**的同时**拿到至少 $1$ 枚金币**。 金币不可分割,只能给人分配整数枚金币。

题目描述

Tonight is brain dinner night and all zombies will gather together to scarf down some delicious brains. The artful Heidi plans to crash the party, incognito, disguised as one of them. Her objective is to get away with at least one brain, so she can analyze the zombies' mindset back home and gain a strategic advantage. They will be $ N $ guests tonight: $ N-1 $ real zombies and a fake one, our Heidi. The living-dead love hierarchies as much as they love brains: each one has a unique rank in the range $ 1 $ to $ N-1 $ , and Heidi, who still appears slightly different from the others, is attributed the highest rank, $ N $ . Tonight there will be a chest with brains on display and every attendee sees how many there are. These will then be split among the attendees according to the following procedure: The zombie of the highest rank makes a suggestion on who gets how many brains (every brain is an indivisible entity). A vote follows. If at least half of the attendees accept the offer, the brains are shared in the suggested way and the feast begins. But if majority is not reached, then the highest-ranked zombie is killed, and the next zombie in hierarchy has to make a suggestion. If he is killed too, then the third highest-ranked makes one, etc. (It's enough to have exactly half of the votes – in case of a tie, the vote of the highest-ranked alive zombie counts twice, and he will of course vote in favor of his own suggestion in order to stay alive.) You should know that zombies are very greedy and sly, and they know this too – basically all zombie brains are alike. Consequently, a zombie will never accept an offer which is suboptimal for him. That is, if an offer is not strictly better than a potential later offer, he will vote against it. And make no mistake: while zombies may normally seem rather dull, tonight their intellects are perfect. Each zombie's priorities for tonight are, in descending order: 1. survive the event (they experienced death already once and know it is no fun), 2. get as many brains as possible. Heidi goes first and must make an offer which at least half of the attendees will accept, and which allocates at least one brain for Heidi herself. What is the smallest number of brains that have to be in the chest for this to be possible?

输入输出格式

输入格式


The only line of input contains one integer: $ N $ , the number of attendees ( $ 1<=N<=10^{9} $ ).

输出格式


Output one integer: the smallest number of brains in the chest which allows Heidi to take one brain home.

输入输出样例

输入样例 #1

1

输出样例 #1

1

输入样例 #2

4

输出样例 #2

2

Input

题意翻译

有 $n$ 个海盗被编号为 $1\sim n$,并且他们都是绝对理智的,并且他们都知道他们都是绝对理智的,等等。 现在他们要分一些金币。从编号 $1$ 的海盗开始,每个人依次提出一个分配方案,接下来所有人(包括提出方案的人)选择赞成或者反对此方案,如果有至少一半人(恰好一半也行)赞成则通过此方案,否则将这个人杀死并由下一个继续提出分配方案。 每个海盗的第一目标都是保命,其次是拿到更多的金币,再其次是杀掉更多的人。 现在你编号为 $1$ 的海盗,求金币数至少为多少时,你可以在**活下来**的同时**拿到至少 $1$ 枚金币**。 金币不可分割,只能给人分配整数枚金币。

加入题单

算法标签: