結果

問題 No.1895 Mod 2
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-04-08 22:32:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 306 ms / 2,000 ms
コード長 314 bytes
コンパイル時間 426 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 79,120 KB
最終ジャッジ日時 2023-08-19 00:58:56
合計ジャッジ時間 4,427 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,780 KB
testcase_01 AC 276 ms
78,732 KB
testcase_02 AC 305 ms
79,120 KB
testcase_03 AC 213 ms
77,916 KB
testcase_04 AC 218 ms
78,216 KB
testcase_05 AC 306 ms
78,648 KB
testcase_06 AC 279 ms
78,612 KB
testcase_07 AC 277 ms
78,584 KB
testcase_08 AC 270 ms
78,636 KB
testcase_09 AC 261 ms
78,588 KB
testcase_10 AC 247 ms
78,632 KB
testcase_11 AC 270 ms
78,892 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