結果

問題 No.1895 Mod 2
ユーザー SSRSSSRS
提出日時 2022-04-08 21:27:38
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 367 bytes
コンパイル時間 2,162 ms
コンパイル使用メモリ 192,800 KB
最終ジャッジ日時 2025-01-28 15:51:21
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int T;
  cin >> T;
  for (int i = 0; i < T; i++){
    long long L, R;
    cin >> L >> R;
    L--;
    long long ans = 0;
    while (L != R){
      long long a = sqrt(R);
      long long b = sqrt(L);
      ans += (a + 1) / 2 - (b + 1) / 2;
      R /= 2;
      L /= 2;
    }
    cout << ans % 2 << endl;
  }
}
0