No.2853 A + B Problem
問題文最終更新日: 2024-08-21 21:37:39
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 442 MMA Contest 019
(順位表)
の他の問題:
Problem Statement
Among integers satisfying $1 \leq A, B \leq N$, how many pairs $(A, B)$ satisfy both of the following conditions?
- $A + B = N$
- $A \ \mathrm{AND} \ B = 0$
Here, $\mathrm{AND}$ denotes the bitwise logical AND.
It can also be proved that, under the constraints of the problem, the answer is less than $2^{60}$.
Constraints
- $1 \leq N < 2^{60}$
- All inputs are integers.
Input
The input is given from standard input in the following format.
$N$
Output
Print the answer to the problem on one line.
Sample
Sample 1
Input
5
Output
2
$(A, B) = (1, 4), (4, 1)$ satisfy the conditions.
Sample 2
Input
1125899906842624
Output
0
Note that the input may not fit in a $32$ bit integer type.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。