結果

問題 No.1895 Mod 2
ユーザー んんんんんん
提出日時 2022-12-30 18:04:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 2,338 ms
コンパイル使用メモリ 199,256 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-16 23:56:18
合計ジャッジ時間 3,679 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 25 ms
4,380 KB
testcase_02 AC 27 ms
4,376 KB
testcase_03 AC 25 ms
4,384 KB
testcase_04 AC 24 ms
4,380 KB
testcase_05 AC 29 ms
4,376 KB
testcase_06 AC 29 ms
4,376 KB
testcase_07 AC 30 ms
4,380 KB
testcase_08 AC 24 ms
4,380 KB
testcase_09 AC 24 ms
4,380 KB
testcase_10 AC 20 ms
4,380 KB
testcase_11 AC 24 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int T;
    cin >> T;
    while (T--) {
        long long L, R;
        cin >> L >> R;
        long long a = 0;
        while (R > 0) {
            long long l = sqrt(L) + 1e-9;
            long long r = sqrt(R) + 1e-9;
            if (l*l != L) l++;

            a += (r+1)/2 - l/2;
            L = L%2 ? L/2+1 : L/2;
            R /= 2;
        }
        cout << a % 2 << endl;
    }
}
0