問題一覧 > 通常問題

No.1986 Yummy

レベル : / AI推定難易度 : 550 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 234
作問者 : milkcoffee / テスター : tokusakurai riano
お気に入りにしたユーザー ProblemId : 7821 / 自分の提出
問題文最終更新日: 2022-06-24 14:28:14
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 349 (順位表) の他の問題:

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$

  • $1 \leq N \leq 10^9$
  • $N$ is an integer
  • 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もしくは右上の雲マークをクリックしてアカウントを作成してください。