結果

問題 No.1258 コインゲーム
ユーザー 👑 KazunKazun
提出日時 2020-10-16 22:08:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 252 ms / 2,000 ms
コード長 263 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 78,084 KB
最終ジャッジ日時 2023-09-28 03:17:05
合計ジャッジ時間 12,362 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
77,296 KB
testcase_01 AC 123 ms
77,372 KB
testcase_02 AC 97 ms
77,036 KB
testcase_03 AC 223 ms
77,272 KB
testcase_04 AC 235 ms
77,556 KB
testcase_05 AC 109 ms
77,368 KB
testcase_06 AC 194 ms
77,448 KB
testcase_07 AC 93 ms
76,692 KB
testcase_08 AC 91 ms
76,752 KB
testcase_09 AC 137 ms
77,556 KB
testcase_10 AC 219 ms
77,252 KB
testcase_11 AC 227 ms
78,084 KB
testcase_12 AC 196 ms
77,428 KB
testcase_13 AC 119 ms
77,656 KB
testcase_14 AC 94 ms
77,028 KB
testcase_15 AC 213 ms
77,524 KB
testcase_16 AC 109 ms
77,560 KB
testcase_17 AC 230 ms
77,596 KB
testcase_18 AC 139 ms
77,644 KB
testcase_19 AC 135 ms
77,512 KB
testcase_20 AC 190 ms
77,556 KB
testcase_21 AC 224 ms
77,708 KB
testcase_22 AC 183 ms
77,548 KB
testcase_23 AC 154 ms
77,528 KB
testcase_24 AC 105 ms
77,124 KB
testcase_25 AC 152 ms
77,344 KB
testcase_26 AC 141 ms
77,532 KB
testcase_27 AC 223 ms
77,580 KB
testcase_28 AC 119 ms
77,484 KB
testcase_29 AC 122 ms
77,548 KB
testcase_30 AC 249 ms
77,608 KB
testcase_31 AC 123 ms
77,208 KB
testcase_32 AC 98 ms
77,048 KB
testcase_33 AC 192 ms
77,640 KB
testcase_34 AC 228 ms
77,644 KB
testcase_35 AC 129 ms
77,172 KB
testcase_36 AC 221 ms
77,716 KB
testcase_37 AC 135 ms
78,064 KB
testcase_38 AC 212 ms
77,556 KB
testcase_39 AC 122 ms
77,528 KB
testcase_40 AC 244 ms
77,688 KB
testcase_41 AC 248 ms
77,700 KB
testcase_42 AC 246 ms
77,676 KB
testcase_43 AC 252 ms
77,556 KB
testcase_44 AC 247 ms
77,608 KB
testcase_45 AC 244 ms
77,296 KB
testcase_46 AC 245 ms
77,728 KB
testcase_47 AC 245 ms
77,580 KB
testcase_48 AC 243 ms
77,664 KB
testcase_49 AC 241 ms
77,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.buffer.readline
S=int(input())
Mod=10**9+7
inv_2=pow(2,Mod-2,Mod)

for _ in range(S):
    N,M,X=map(int,input().split())

    alpha=pow(1+M,N,Mod)
    beta =pow(1-M,N,Mod)
    gamma=alpha+pow(-1,X,Mod)*beta

    print((gamma*inv_2)%Mod)
0