No.1986 Yummy
タグ : / 解いたユーザー数 234
作問者 :
milkcoffee
/ テスター :
riano
Problem Statement
$N$ candies are lined up in $1$ row.
The candies at odd positions from the left are "delicious candies", and the candies at even positions are "ordinary candies".
$2$ people take turns choosing and eating $1$ candy, which must be at the front or the back of the row at that moment.
They continue this until no candies remain.
When both players act optimally to eat as many delicious candies as possible,
find the number of delicious candies the first player can eat.
Input
$N$
Output
Output as an integer the maximum number of delicious candies the first player can eat.
Sample
Sample 1
Input
3
Output
1
Representing a delicious candy by o and an ordinary candy by x, the initial arrangement is as follows.
oxo
When both players act optimally, each of them can eat $1$ delicious candy.
Sample 2
Input
4
Output
2
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。