結果

問題 No.2393 Bit Grid Connected Component
ユーザー ochiaigawa
提出日時 2023-07-28 21:30:53
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 480 bytes
コンパイル時間 1,886 ms
コンパイル使用メモリ 194,248 KB
最終ジャッジ日時 2025-02-15 20:02:54
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
vector<long long> c(61);
void solve() {
  long long x;
  int y;
  cin >> x >> y;
  if(!(x >> y & 1)) {
    cout << 0 << '\n';
  } else {
    int i = 0;
    while(!(x >> i & 1)) {
      i++;
    }
    while(x >> i & 1) {
      i++;
    }
    cout << c[i - 1] << '\n';
  }
}
int main() {
  c[0] = 1;
  for(int i = 1; i < 61; i++) {
    c[i] = c[i - 1] + (1LL << i);
  }
  int T;
  cin >> T;
  while(T--) {
    solve();
  }
  return 0;
}
0