結果

問題 No.1800 Random XOR
ユーザー kohei2019kohei2019
提出日時 2023-06-19 22:40:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 494 bytes
コンパイル時間 629 ms
コンパイル使用メモリ 86,924 KB
実行使用メモリ 71,324 KB
最終ジャッジ日時 2023-09-09 17:54:05
合計ジャッジ時間 2,684 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,088 KB
testcase_01 AC 71 ms
71,196 KB
testcase_02 AC 70 ms
71,124 KB
testcase_03 AC 70 ms
71,096 KB
testcase_04 AC 70 ms
71,064 KB
testcase_05 AC 70 ms
70,868 KB
testcase_06 AC 73 ms
71,272 KB
testcase_07 AC 72 ms
71,324 KB
testcase_08 AC 76 ms
71,232 KB
testcase_09 AC 71 ms
71,296 KB
testcase_10 AC 72 ms
71,212 KB
testcase_11 AC 71 ms
71,088 KB
testcase_12 AC 70 ms
71,220 KB
testcase_13 AC 70 ms
71,144 KB
testcase_14 AC 71 ms
71,304 KB
testcase_15 AC 73 ms
71,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def invmod(a,mod):#mod逆元
    if a == 0:
        return 0
    if a == 1:
        return 1
    return (-invmod(mod % a, mod) * (mod // a)) % mod

def modPow(a,n,mod):#繰り返し二乗法 a**n % mod
    if n==0:
        return 1
    if n==1:
        return a%mod
    if n & 1:
        return (a*modPow(a,n-1,mod)) % mod
    t = modPow(a,n>>1,mod)
    return (t*t)%mod

N,M = map(int,input().split())
mod = 10**9+7
inv2 = invmod(2, mod)
ans = (modPow(2, M, mod)-1)*inv2
ans %= mod
print(ans)
0