結果

問題 No.1258 コインゲーム
ユーザー rlangevinrlangevin
提出日時 2023-02-06 08:55:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 470 ms / 2,000 ms
コード長 237 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 86,896 KB
実行使用メモリ 78,728 KB
最終ジャッジ日時 2023-09-17 20:56:53
合計ジャッジ時間 20,166 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 179 ms
78,232 KB
testcase_01 AC 193 ms
78,184 KB
testcase_02 AC 137 ms
78,336 KB
testcase_03 AC 383 ms
78,396 KB
testcase_04 AC 425 ms
78,460 KB
testcase_05 AC 157 ms
78,172 KB
testcase_06 AC 342 ms
78,456 KB
testcase_07 AC 131 ms
78,256 KB
testcase_08 AC 127 ms
78,276 KB
testcase_09 AC 222 ms
78,448 KB
testcase_10 AC 385 ms
78,392 KB
testcase_11 AC 415 ms
78,392 KB
testcase_12 AC 330 ms
78,488 KB
testcase_13 AC 177 ms
78,088 KB
testcase_14 AC 129 ms
78,188 KB
testcase_15 AC 382 ms
78,604 KB
testcase_16 AC 162 ms
78,184 KB
testcase_17 AC 423 ms
78,452 KB
testcase_18 AC 222 ms
78,448 KB
testcase_19 AC 212 ms
78,448 KB
testcase_20 AC 332 ms
78,444 KB
testcase_21 AC 394 ms
78,608 KB
testcase_22 AC 309 ms
78,728 KB
testcase_23 AC 260 ms
78,272 KB
testcase_24 AC 170 ms
78,188 KB
testcase_25 AC 252 ms
78,464 KB
testcase_26 AC 227 ms
78,480 KB
testcase_27 AC 394 ms
78,484 KB
testcase_28 AC 180 ms
78,280 KB
testcase_29 AC 186 ms
78,248 KB
testcase_30 AC 459 ms
78,404 KB
testcase_31 AC 197 ms
78,184 KB
testcase_32 AC 146 ms
78,252 KB
testcase_33 AC 341 ms
78,436 KB
testcase_34 AC 402 ms
78,392 KB
testcase_35 AC 208 ms
78,400 KB
testcase_36 AC 391 ms
78,292 KB
testcase_37 AC 219 ms
78,536 KB
testcase_38 AC 372 ms
78,452 KB
testcase_39 AC 183 ms
78,180 KB
testcase_40 AC 461 ms
78,636 KB
testcase_41 AC 470 ms
78,468 KB
testcase_42 AC 466 ms
78,656 KB
testcase_43 AC 457 ms
78,712 KB
testcase_44 AC 458 ms
78,596 KB
testcase_45 AC 458 ms
78,652 KB
testcase_46 AC 456 ms
78,592 KB
testcase_47 AC 453 ms
78,464 KB
testcase_48 AC 451 ms
78,496 KB
testcase_49 AC 457 ms
78,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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