結果

問題 No.939 and or
ユーザー pengin_2000
提出日時 2020-03-12 19:45:43
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 346 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 29,824 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-19 04:47:27
合計ジャッジ時間 1,261 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
int main()
{
	int a, b;
	scanf("%d %d", &a, &b);
	int c = 0;
	while (a > 0 || b > 0)
	{
		if (a % 2 > 0)
		{
			if (b % 2 == 0)
			{
				printf("0\n");
				return 0;
			}
		}
		else
		{
			if (b % 2 > 0)
				c++;
		}
		a /= 2;
		b /= 2;
	}
	int ans = 1;
	while (c > 1)
	{
		c--;
		ans *= 2;
	}
	printf("%d\n", ans);
	return 0;
}
0