結果

問題 No.1895 Mod 2
ユーザー hir355hir355
提出日時 2022-04-09 01:13:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 156 ms / 2,000 ms
コード長 306 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 86,840 KB
実行使用メモリ 78,344 KB
最終ジャッジ日時 2023-08-19 03:33:46
合計ジャッジ時間 2,878 ms
ジャッジサーバーID
(参考情報)
judge15 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,300 KB
testcase_01 AC 156 ms
77,956 KB
testcase_02 AC 150 ms
78,300 KB
testcase_03 AC 141 ms
78,160 KB
testcase_04 AC 140 ms
78,344 KB
testcase_05 AC 148 ms
77,692 KB
testcase_06 AC 152 ms
77,524 KB
testcase_07 AC 153 ms
77,424 KB
testcase_08 AC 151 ms
77,932 KB
testcase_09 AC 154 ms
78,136 KB
testcase_10 AC 138 ms
78,200 KB
testcase_11 AC 148 ms
78,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(n):
    l, r = 0, 10 ** 9
    while r - l > 1:
        m = (l + r) // 2
        if m * m <= n:
            l = m
        else:
            r = m
    return l % 2

t = int(input())
for _ in range(t):
    l, r = map(int, input().split())
    l -= 1
    print((f(r) - f(r // 2) - f(l) + f(l // 2)) % 2)
0