結果

問題 No.1258 コインゲーム
ユーザー uni_pythonuni_python
提出日時 2020-10-18 16:21:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 355 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 87,236 KB
実行使用メモリ 77,712 KB
最終ジャッジ日時 2023-09-28 11:51:09
合計ジャッジ時間 18,475 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
77,540 KB
testcase_01 AC 161 ms
77,480 KB
testcase_02 AC 124 ms
77,452 KB
testcase_03 AC 305 ms
77,588 KB
testcase_04 AC 330 ms
77,480 KB
testcase_05 AC 136 ms
77,348 KB
testcase_06 AC 266 ms
77,572 KB
testcase_07 AC 115 ms
77,584 KB
testcase_08 AC 110 ms
76,968 KB
testcase_09 AC 181 ms
77,560 KB
testcase_10 AC 297 ms
77,332 KB
testcase_11 AC 324 ms
77,668 KB
testcase_12 AC 265 ms
77,292 KB
testcase_13 AC 150 ms
77,596 KB
testcase_14 AC 116 ms
77,488 KB
testcase_15 AC 294 ms
77,588 KB
testcase_16 AC 137 ms
77,568 KB
testcase_17 AC 324 ms
77,616 KB
testcase_18 AC 183 ms
77,532 KB
testcase_19 AC 174 ms
77,508 KB
testcase_20 AC 269 ms
77,504 KB
testcase_21 AC 309 ms
77,536 KB
testcase_22 AC 245 ms
77,256 KB
testcase_23 AC 209 ms
77,396 KB
testcase_24 AC 139 ms
77,288 KB
testcase_25 AC 201 ms
77,372 KB
testcase_26 AC 187 ms
77,544 KB
testcase_27 AC 305 ms
77,364 KB
testcase_28 AC 152 ms
77,212 KB
testcase_29 AC 156 ms
77,628 KB
testcase_30 AC 355 ms
77,536 KB
testcase_31 AC 162 ms
77,376 KB
testcase_32 AC 126 ms
77,608 KB
testcase_33 AC 269 ms
77,560 KB
testcase_34 AC 310 ms
77,684 KB
testcase_35 AC 171 ms
77,336 KB
testcase_36 AC 304 ms
77,280 KB
testcase_37 AC 178 ms
77,264 KB
testcase_38 AC 291 ms
77,540 KB
testcase_39 AC 155 ms
77,432 KB
testcase_40 AC 337 ms
77,708 KB
testcase_41 AC 339 ms
77,452 KB
testcase_42 AC 338 ms
77,520 KB
testcase_43 AC 337 ms
77,452 KB
testcase_44 AC 338 ms
77,712 KB
testcase_45 AC 338 ms
77,668 KB
testcase_46 AC 336 ms
77,544 KB
testcase_47 AC 338 ms
77,636 KB
testcase_48 AC 337 ms
77,672 KB
testcase_49 AC 341 ms
77,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    S=I()
    for _ in range(S):
        N,M,X=MI()
        a=pow((1-M),N,mod)
        b=pow((1+M),N,mod)
        
        
        if X:
            ans=(b-a)*pow(2,mod-2,mod)
        else:
            ans=(a+b)*pow(2,mod-2,mod)
            
        print(ans%mod)
        
        


main()
0