No.939 and or
レベル :
/ AI推定難易度 : 800
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 240
作問者 :
%20
/ テスター :
kotatsugame
タグ : / 解いたユーザー数 240
作問者 :
%20
/ テスター :
問題文最終更新日: 2026-06-30 08:14:44
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
Advent Calendar Contest 2019
(順位表)
の他の問題:
Problem Statement
Find the number of pairs of non-negative integers $(X,Y)$ satisfying $X \le Y$, $X \land Y=A$, and $X \lor Y=B$.
Here, $\land$ denotes the bitwise AND, and $\lor$ denotes the bitwise OR.
Input
$A$ $B$
The input satisfies the following constraints.
- $0 \le A,B \lt 2^{31}$
- $A,B$ are integers.
Output
Output the number of pairs $(X,Y)$ satisfying the conditions.
Sample
Sample 1
Input
4 7
Output
2
The pairs $(X,Y)$ satisfying the conditions are $(4,7),(5,6)$.
Sample 2
Input
12345 54321
Output
0
There may be no pairs $(X,Y)$ satisfying the conditions.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。