問題一覧 > 通常問題

No.1452 XOR×OR

レベル : / AI推定難易度 : 1000 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 89
作問者 : NaHCO314 / テスター : shiomusubi496
お気に入りにしたユーザー ProblemId : 6094 / 自分の提出
問題文最終更新日: 2021-03-31 13:16:41
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
新入生プログラミングコンテスト 2021(昼の部) (順位表) の他の問題:

Problem Statement

You are given a positive integer $N$. Output the total number of pairs of non-negative integers $A,B(A\leq B)$ such that $(A\oplus B)×(A|B)=N$. Here, $A\oplus B$ denotes the bitwise exclusive OR of $A$ and $B$, and $A|B$ denotes the bitwise OR of $A$ and $B$.

Input

$N$

Constraints

$1\leq N\leq 10^9$

Output

Output the answer on $1$ line.

Print a newline at the end.

Sample

Sample 1
Input
3
Output
1

$(A\oplus B)×(A|B)=3$ holds only when $A=2,B=3$.

Sample 2
Input
123
Output
1

Sample 3
Input
314159265
Output
35

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