結果

問題 No.1895 Mod 2
ユーザー Hydru
提出日時 2022-04-08 23:34:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 393 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 82,244 KB
実行使用メモリ 77,960 KB
最終ジャッジ日時 2024-11-28 14:46:23
合計ジャッジ時間 6,567 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 4 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())

def counts_pow(n,M,k):
    if M==0:
        return 0
    l,r=0,M
    while(r-l>1):
        mid=(r+l)//2
        if mid**n*k<=M:
            l=mid
        else:
            r=mid
    return l

for _ in range(T):
    L, R = map(int,input().split())
    count=0
    count+=counts_pow(2,R,1)-counts_pow(2,L-1,1)
    count+=counts_pow(2,R,2)-counts_pow(2,L-1,2)
    print(count%2)
0