問題一覧 > 通常問題

No.589 Counting Even

レベル : / AI推定難易度 : 1050 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 126
作問者 : Pulmn / テスター : tubo28
お気に入りにしたユーザー ProblemId : 1594 / 自分の提出
問題文最終更新日: 2026-06-26 09:07:46
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 176 (順位表) の他の問題:

Problem Statement

Given a non-negative integer $N$, find the number of $i$ with $0\le i\le N$ such that ${}_N\mathrm {C}_ i$ is even.

Input

$N$

$0\le N\le 10^{18}$

Output

Output the number of $i$ with $0\le i\le N$ such that ${}_N\mathrm {C}_ i$ is even. Print a newline at the end.

Sample

Sample 1
Input
4
Output
3

Since $({}_4\mathrm {C}_0,{}_4\mathrm {C}_1,{}_4\mathrm {C}_2,{}_4\mathrm {C}_3,{}_4\mathrm {C}_4)=(1,4,6,4,1)$, there are $3$ values of $i$ such that ${}_4\mathrm {C}_i$ is even: $1$, $2$, and $3$.

Sample 2
Input
3
Output
0

${}_3\mathrm {C}_0,{}_3\mathrm {C}_1,{}_3\mathrm {C}_2,{}_3\mathrm {C}_3$ are all odd.

Sample 3
Input
0
Output
0

The value of ${}_0\mathrm {C}_0$ is $1$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。