結果

問題 No.939 and or
ユーザー kotatsugame
提出日時 2019-11-29 01:37:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 279 bytes
コンパイル時間 649 ms
コンパイル使用メモリ 65,056 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-20 12:25:56
合計ジャッジ時間 1,877 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
long A,B;
main()
{
	cin>>A>>B;
	long DP0=1,DP1=0;
	for(int i=30;i>=0;i--)
	{
		if(A>>i&1)
		{
			if(!(B>>i&1))
			{
				cout<<0<<endl;
				return 0;
			}
		}
		else if(B>>i&1)
		{
			DP1=DP0+DP1*2;
			DP0=0;
		}
	}
	cout<<DP0+DP1<<endl;
}
0