303567: CF690A2. Collective Mindsets (medium)

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

Description

Collective Mindsets (medium)

题意翻译

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

题目描述

Way to go! Heidi now knows how many brains there must be for her to get one. But throwing herself in the midst of a clutch of hungry zombies is quite a risky endeavor. Hence Heidi wonders: what is the smallest number of brains that must be in the chest for her to get out at all (possibly empty-handed, but alive)? The brain dinner night will evolve just as in the previous subtask: the same crowd is present, the $ N-1 $ zombies have the exact same mindset as before and Heidi is to make the first proposal, which must be accepted by at least half of the attendees for her to survive.

输入输出格式

输入格式


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 merely survive.

输入输出样例

输入样例 #1

1

输出样例 #1

0

输入样例 #2

3

输出样例 #2

1

输入样例 #3

99

输出样例 #3

49

Input

题意翻译

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

加入题单

算法标签: