No.589 Counting Even
問題文最終更新日: 2026-06-26 09:07:46
English (AI translation)
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もしくは右上の雲マークをクリックしてアカウントを作成してください。
Pulmn
tubo28