結果

問題 No.1895 Mod 2
ユーザー ああいいああいい
提出日時 2022-04-08 22:20:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,702 ms / 2,000 ms
コード長 489 bytes
コンパイル時間 387 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 78,848 KB
最終ジャッジ日時 2024-05-06 07:52:28
合計ジャッジ時間 13,201 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
59,392 KB
testcase_01 AC 969 ms
76,416 KB
testcase_02 AC 1,195 ms
78,848 KB
testcase_03 AC 979 ms
76,800 KB
testcase_04 AC 1,180 ms
77,312 KB
testcase_05 AC 1,666 ms
76,800 KB
testcase_06 AC 1,655 ms
77,184 KB
testcase_07 AC 1,702 ms
76,672 KB
testcase_08 AC 570 ms
76,800 KB
testcase_09 AC 603 ms
76,928 KB
testcase_10 AC 174 ms
76,160 KB
testcase_11 AC 936 ms
76,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())

def calc(x):
    ans = 0
    i = 1
    while i <= x:
        end = x + 1
        start = 1
        while end - start > 1:
            mid = end + start >> 1
            if mid * mid * i <= x:
                start = mid
            else:
                end = mid
        #print(i,x,(start + 1) % 2)
        ans += (start + 1) // 2 % 2
        i *= 2
    return ans % 2
for _ in range(T):
    l,r = map(int,input().split())
    ans = calc(r) - calc(l-1)
    print(ans%2)
0