結果

問題 No.1895 Mod 2
ユーザー ShirotsumeShirotsume
提出日時 2021-12-09 12:43:01
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 440 bytes
コンパイル時間 446 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 79,436 KB
最終ジャッジ日時 2023-08-18 18:59:27
合計ジャッジ時間 2,982 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(l, r):
    def check(x):
        if x == 0:
            return 0
        ok = 0
        ng = 10 ** 9 + 1
        while abs(ok - ng) > 1:
            mid = (ok + ng) // 2
            if mid * mid <= x:
                ok = mid
            else:
                ng = mid
        return ok
    sq = check(r) - check(l - 1)
    return sq % 2

for _ in range(int(input())):
    l, r = map(int,input().split())
    print(solve(l, r))

0