結果

問題 No.939 and or
ユーザー 東前頭十一枚目
提出日時 2019-12-12 11:07:00
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 328 bytes
コンパイル時間 1,403 ms
コンパイル使用メモリ 166,732 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-24 21:07:10
合計ジャッジ時間 2,441 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	int a, b; cin >> a >> b;
	int cnt = 0;
	for(int i = 30; i >= 0; --i) {
		int aa = (a >> i) & 1;
		int bb = (b >> i) & 1;
		if(aa == bb) continue;
		if(aa > bb) {
			cout << 0 << '\n';
			return 0;
		}
		++cnt;
	}
	cout << (1 << max(0, cnt - 1)) << '\n';
	return 0;
}
0