結果

問題 No.1895 Mod 2
ユーザー Hydru
提出日時 2022-04-09 00:27:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 816 ms / 2,000 ms
コード長 401 bytes
コンパイル時間 221 ms
コンパイル使用メモリ 82,656 KB
実行使用メモリ 77,792 KB
最終ジャッジ日時 2024-11-28 16:02:31
合計ジャッジ時間 6,703 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())

def counts_pow(n,M,k):
    if M==0:
        return 0
    l,r=0,M+1
    while(r-l>1):
        mid=(r+l)//2
        if k*mid**n<=M:
            l=mid
        else:
            r=mid
    return l
ans=[]
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