結果

問題 No.1258 コインゲーム
ユーザー 37zigen37zigen
提出日時 2020-12-19 07:32:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,508 ms / 2,000 ms
コード長 206 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 11,780 KB
実行使用メモリ 10,048 KB
最終ジャッジ日時 2023-10-21 09:04:26
合計ジャッジ時間 49,225 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 305 ms
10,048 KB
testcase_01 AC 374 ms
10,048 KB
testcase_02 AC 152 ms
10,048 KB
testcase_03 AC 1,181 ms
10,048 KB
testcase_04 AC 1,324 ms
10,048 KB
testcase_05 AC 229 ms
10,048 KB
testcase_06 AC 991 ms
10,048 KB
testcase_07 AC 115 ms
10,048 KB
testcase_08 AC 103 ms
10,048 KB
testcase_09 AC 484 ms
10,048 KB
testcase_10 AC 1,275 ms
10,048 KB
testcase_11 AC 1,415 ms
10,048 KB
testcase_12 AC 1,031 ms
10,048 KB
testcase_13 AC 333 ms
10,048 KB
testcase_14 AC 121 ms
10,048 KB
testcase_15 AC 1,173 ms
10,048 KB
testcase_16 AC 252 ms
10,048 KB
testcase_17 AC 1,331 ms
10,048 KB
testcase_18 AC 518 ms
10,048 KB
testcase_19 AC 458 ms
10,048 KB
testcase_20 AC 980 ms
10,048 KB
testcase_21 AC 1,205 ms
10,048 KB
testcase_22 AC 832 ms
10,048 KB
testcase_23 AC 616 ms
10,048 KB
testcase_24 AC 248 ms
10,048 KB
testcase_25 AC 602 ms
10,048 KB
testcase_26 AC 533 ms
10,048 KB
testcase_27 AC 1,180 ms
10,048 KB
testcase_28 AC 320 ms
10,048 KB
testcase_29 AC 355 ms
10,048 KB
testcase_30 AC 1,477 ms
10,048 KB
testcase_31 AC 392 ms
10,048 KB
testcase_32 AC 184 ms
10,048 KB
testcase_33 AC 1,001 ms
10,048 KB
testcase_34 AC 1,227 ms
10,048 KB
testcase_35 AC 453 ms
10,048 KB
testcase_36 AC 1,176 ms
10,048 KB
testcase_37 AC 469 ms
10,048 KB
testcase_38 AC 1,116 ms
10,048 KB
testcase_39 AC 332 ms
10,048 KB
testcase_40 AC 1,482 ms
10,048 KB
testcase_41 AC 1,462 ms
10,048 KB
testcase_42 AC 1,479 ms
10,048 KB
testcase_43 AC 1,502 ms
10,048 KB
testcase_44 AC 1,508 ms
10,048 KB
testcase_45 AC 1,441 ms
10,048 KB
testcase_46 AC 1,457 ms
10,048 KB
testcase_47 AC 1,470 ms
10,048 KB
testcase_48 AC 1,458 ms
10,048 KB
testcase_49 AC 1,448 ms
10,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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