結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 324 ms
10,124 KB
testcase_01 AC 401 ms
10,124 KB
testcase_02 AC 164 ms
10,124 KB
testcase_03 AC 1,268 ms
10,124 KB
testcase_04 AC 1,440 ms
10,124 KB
testcase_05 AC 251 ms
10,124 KB
testcase_06 AC 1,038 ms
10,124 KB
testcase_07 AC 126 ms
10,124 KB
testcase_08 AC 113 ms
10,124 KB
testcase_09 AC 535 ms
10,124 KB
testcase_10 AC 1,249 ms
10,124 KB
testcase_11 AC 1,401 ms
10,124 KB
testcase_12 AC 1,015 ms
10,124 KB
testcase_13 AC 332 ms
10,124 KB
testcase_14 AC 125 ms
10,124 KB
testcase_15 AC 1,212 ms
10,124 KB
testcase_16 AC 259 ms
10,124 KB
testcase_17 AC 1,374 ms
10,124 KB
testcase_18 AC 522 ms
10,124 KB
testcase_19 AC 486 ms
10,124 KB
testcase_20 AC 1,028 ms
10,124 KB
testcase_21 AC 1,313 ms
10,124 KB
testcase_22 AC 912 ms
10,124 KB
testcase_23 AC 697 ms
10,124 KB
testcase_24 AC 266 ms
10,124 KB
testcase_25 AC 639 ms
10,124 KB
testcase_26 AC 554 ms
10,124 KB
testcase_27 AC 1,252 ms
10,124 KB
testcase_28 AC 346 ms
10,124 KB
testcase_29 AC 368 ms
10,124 KB
testcase_30 AC 1,565 ms
10,124 KB
testcase_31 AC 407 ms
10,124 KB
testcase_32 AC 192 ms
10,124 KB
testcase_33 AC 1,052 ms
10,124 KB
testcase_34 AC 1,315 ms
10,124 KB
testcase_35 AC 477 ms
10,124 KB
testcase_36 AC 1,282 ms
10,124 KB
testcase_37 AC 507 ms
10,124 KB
testcase_38 AC 1,203 ms
10,124 KB
testcase_39 AC 353 ms
10,124 KB
testcase_40 AC 1,587 ms
10,124 KB
testcase_41 AC 1,593 ms
10,124 KB
testcase_42 AC 1,608 ms
10,124 KB
testcase_43 AC 1,590 ms
10,124 KB
testcase_44 AC 1,604 ms
10,124 KB
testcase_45 AC 1,603 ms
10,124 KB
testcase_46 AC 1,604 ms
10,124 KB
testcase_47 AC 1,600 ms
10,124 KB
testcase_48 AC 1,605 ms
10,124 KB
testcase_49 AC 1,581 ms
10,124 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)
    ans = (a + b) if X == 0 else (a - b)
    ans = ans * pow(2, p - 2, p) % p
    print(ans)
0