結果

問題 No.1258 コインゲーム
ユーザー tktk_snsntktk_snsn
提出日時 2022-05-17 17:37:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,285 ms / 2,000 ms
コード長 297 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 7,988 KB
最終ジャッジ日時 2023-10-13 16:30:55
合計ジャッジ時間 39,440 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 255 ms
7,844 KB
testcase_01 AC 311 ms
7,892 KB
testcase_02 AC 122 ms
7,840 KB
testcase_03 AC 993 ms
7,856 KB
testcase_04 AC 1,131 ms
7,776 KB
testcase_05 AC 191 ms
7,932 KB
testcase_06 AC 825 ms
7,912 KB
testcase_07 AC 93 ms
7,908 KB
testcase_08 AC 82 ms
7,860 KB
testcase_09 AC 415 ms
7,816 KB
testcase_10 AC 1,003 ms
7,852 KB
testcase_11 AC 1,120 ms
7,772 KB
testcase_12 AC 804 ms
7,848 KB
testcase_13 AC 255 ms
7,900 KB
testcase_14 AC 90 ms
7,864 KB
testcase_15 AC 956 ms
7,840 KB
testcase_16 AC 198 ms
7,856 KB
testcase_17 AC 1,082 ms
7,888 KB
testcase_18 AC 409 ms
7,860 KB
testcase_19 AC 375 ms
7,936 KB
testcase_20 AC 803 ms
7,932 KB
testcase_21 AC 1,030 ms
7,796 KB
testcase_22 AC 715 ms
7,800 KB
testcase_23 AC 528 ms
7,940 KB
testcase_24 AC 207 ms
7,988 KB
testcase_25 AC 509 ms
7,868 KB
testcase_26 AC 438 ms
7,932 KB
testcase_27 AC 1,006 ms
7,788 KB
testcase_28 AC 266 ms
7,800 KB
testcase_29 AC 286 ms
7,892 KB
testcase_30 AC 1,247 ms
7,796 KB
testcase_31 AC 317 ms
7,768 KB
testcase_32 AC 144 ms
7,836 KB
testcase_33 AC 836 ms
7,932 KB
testcase_34 AC 1,029 ms
7,844 KB
testcase_35 AC 362 ms
7,792 KB
testcase_36 AC 1,005 ms
7,860 KB
testcase_37 AC 398 ms
7,980 KB
testcase_38 AC 946 ms
7,856 KB
testcase_39 AC 271 ms
7,872 KB
testcase_40 AC 1,271 ms
7,956 KB
testcase_41 AC 1,266 ms
7,860 KB
testcase_42 AC 1,267 ms
7,844 KB
testcase_43 AC 1,275 ms
7,920 KB
testcase_44 AC 1,262 ms
7,816 KB
testcase_45 AC 1,285 ms
7,952 KB
testcase_46 AC 1,269 ms
7,840 KB
testcase_47 AC 1,273 ms
7,848 KB
testcase_48 AC 1,270 ms
7,860 KB
testcase_49 AC 1,260 ms
7,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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