結果

問題 No.1895 Mod 2
ユーザー HydruHydru
提出日時 2022-04-09 00:27:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 783 ms / 2,000 ms
コード長 401 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 87,284 KB
実行使用メモリ 80,168 KB
最終ジャッジ日時 2023-08-19 02:56:24
合計ジャッジ時間 6,718 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
71,496 KB
testcase_01 AC 481 ms
79,024 KB
testcase_02 AC 600 ms
80,168 KB
testcase_03 AC 468 ms
78,808 KB
testcase_04 AC 488 ms
77,884 KB
testcase_05 AC 778 ms
78,092 KB
testcase_06 AC 774 ms
78,444 KB
testcase_07 AC 783 ms
78,460 KB
testcase_08 AC 310 ms
78,032 KB
testcase_09 AC 317 ms
78,616 KB
testcase_10 AC 150 ms
78,888 KB
testcase_11 AC 387 ms
79,036 KB
権限があれば一括ダウンロードができます

ソースコード

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