結果

問題 No.1895 Mod 2
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-04-08 22:32:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 237 ms / 2,000 ms
コード長 314 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 77,348 KB
最終ジャッジ日時 2024-05-06 08:03:01
合計ジャッジ時間 3,131 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,352 KB
testcase_01 AC 212 ms
77,056 KB
testcase_02 AC 237 ms
77,348 KB
testcase_03 AC 163 ms
76,672 KB
testcase_04 AC 167 ms
76,928 KB
testcase_05 AC 212 ms
76,928 KB
testcase_06 AC 212 ms
76,800 KB
testcase_07 AC 208 ms
77,184 KB
testcase_08 AC 207 ms
76,672 KB
testcase_09 AC 216 ms
76,928 KB
testcase_10 AC 210 ms
77,184 KB
testcase_11 AC 212 ms
77,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #



def f(x):
    if x==0:return 0
    if x==1:return 1
    res=0
    for k in range(64):
        y=x//(2**k)
        m=int(y**0.5)
        if (m+1)**2<=y:m+=1
        if m**2>y:m-=1
        res+=(m+1)//2
    return res
T=int(input())
for _ in range(T):
    l,r=map(int,input().split())
    print((f(r)-f(l-1))%2)

0