結果

問題 No.1258 コインゲーム
ユーザー chineristACchineristAC
提出日時 2020-10-16 23:34:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 282 ms / 2,000 ms
コード長 311 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 78,164 KB
最終ジャッジ日時 2023-09-28 05:46:45
合計ジャッジ時間 13,816 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
77,392 KB
testcase_01 AC 141 ms
77,220 KB
testcase_02 AC 114 ms
77,368 KB
testcase_03 AC 246 ms
77,380 KB
testcase_04 AC 265 ms
77,428 KB
testcase_05 AC 123 ms
77,152 KB
testcase_06 AC 217 ms
77,176 KB
testcase_07 AC 110 ms
77,196 KB
testcase_08 AC 104 ms
76,840 KB
testcase_09 AC 155 ms
77,148 KB
testcase_10 AC 240 ms
77,736 KB
testcase_11 AC 260 ms
77,420 KB
testcase_12 AC 214 ms
77,404 KB
testcase_13 AC 135 ms
77,240 KB
testcase_14 AC 107 ms
76,364 KB
testcase_15 AC 239 ms
77,380 KB
testcase_16 AC 123 ms
77,288 KB
testcase_17 AC 260 ms
77,528 KB
testcase_18 AC 156 ms
77,364 KB
testcase_19 AC 153 ms
77,252 KB
testcase_20 AC 216 ms
77,260 KB
testcase_21 AC 250 ms
77,600 KB
testcase_22 AC 208 ms
77,384 KB
testcase_23 AC 177 ms
77,176 KB
testcase_24 AC 122 ms
77,504 KB
testcase_25 AC 172 ms
77,440 KB
testcase_26 AC 158 ms
77,212 KB
testcase_27 AC 246 ms
77,424 KB
testcase_28 AC 137 ms
77,152 KB
testcase_29 AC 138 ms
77,296 KB
testcase_30 AC 282 ms
77,248 KB
testcase_31 AC 141 ms
77,624 KB
testcase_32 AC 116 ms
77,340 KB
testcase_33 AC 220 ms
77,244 KB
testcase_34 AC 252 ms
77,080 KB
testcase_35 AC 148 ms
77,208 KB
testcase_36 AC 246 ms
77,500 KB
testcase_37 AC 156 ms
77,268 KB
testcase_38 AC 239 ms
77,436 KB
testcase_39 AC 137 ms
77,148 KB
testcase_40 AC 277 ms
77,472 KB
testcase_41 AC 280 ms
77,380 KB
testcase_42 AC 277 ms
77,700 KB
testcase_43 AC 278 ms
77,544 KB
testcase_44 AC 278 ms
77,208 KB
testcase_45 AC 280 ms
77,608 KB
testcase_46 AC 277 ms
77,692 KB
testcase_47 AC 278 ms
77,952 KB
testcase_48 AC 279 ms
78,164 KB
testcase_49 AC 279 ms
78,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

input = sys.stdin.readline

mod = 10**9+7
inv = pow(2,mod-2,mod)
for _  in range(int(input())):
    N,M,X = map(int,input().split())
    if X==1:
        res = pow(1+M,N,mod) - pow(1-M,N,mod)
    else:
        res = pow(1+M,N,mod) + pow(1-M,N,mod)
    res %= mod
    res *= inv
    print(res % mod)
0