結果
| 問題 |
No.939 and or
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-14 18:12:54 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 481 bytes |
| コンパイル時間 | 2,667 ms |
| コンパイル使用メモリ | 191,628 KB |
| 最終ジャッジ日時 | 2025-01-09 18:48:53 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 WA * 3 TLE * 15 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
long a,b,cur,i,ans;
cin >> a >> b;
cur=0;
if(a>b){
cout << 0 << endl; return 0;
}
for(i=0; (1<<i)<=b; i++){
if(((1<<i) & a)&& !((1<<i) & b)){
cout << 0 << endl; return 0;
}
if((1<<i) & b-a){
cur++;
}
}
if(cur==0){
cout << 0 << endl;
}else{
ans=1;
for(i=1; i<cur; i++){
ans*=2;
}
cout << ans << endl;
}
return 0;
}