結果

問題 No.1957 Xor Min
ユーザー umezo
提出日時 2022-05-27 22:23:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 447 bytes
コンパイル時間 1,766 ms
コンパイル使用メモリ 193,108 KB
最終ジャッジ日時 2025-01-29 16:06:51
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  ll a,b;
  cin>>a>>b;
  if(a>b) swap(a,b);
  ll c=a,d=b;
  int t0=0,t1=0;
  while(c>0){
    t0++;
    c/=2;
  }
  while(d>0){
    t1++;
    d/=2;
  }
  if(t0!=t1) cout<<a<<endl;
  else cout<<(1<<(t0-1))-1<<endl;

  return 0;
}
0