結果

問題 No.1258 コインゲーム
ユーザー 👑 tamatotamato
提出日時 2020-10-16 21:35:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 244 ms / 2,000 ms
コード長 422 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 87,412 KB
実行使用メモリ 78,192 KB
最終ジャッジ日時 2023-09-28 02:37:45
合計ジャッジ時間 12,308 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
77,852 KB
testcase_01 AC 126 ms
77,652 KB
testcase_02 AC 96 ms
76,912 KB
testcase_03 AC 211 ms
77,768 KB
testcase_04 AC 228 ms
78,060 KB
testcase_05 AC 107 ms
77,736 KB
testcase_06 AC 192 ms
77,532 KB
testcase_07 AC 92 ms
77,172 KB
testcase_08 AC 93 ms
77,068 KB
testcase_09 AC 136 ms
77,968 KB
testcase_10 AC 212 ms
77,996 KB
testcase_11 AC 222 ms
77,724 KB
testcase_12 AC 191 ms
77,868 KB
testcase_13 AC 115 ms
77,760 KB
testcase_14 AC 90 ms
76,968 KB
testcase_15 AC 205 ms
77,664 KB
testcase_16 AC 108 ms
77,696 KB
testcase_17 AC 226 ms
77,732 KB
testcase_18 AC 132 ms
77,640 KB
testcase_19 AC 129 ms
77,676 KB
testcase_20 AC 185 ms
77,728 KB
testcase_21 AC 213 ms
77,692 KB
testcase_22 AC 184 ms
77,732 KB
testcase_23 AC 153 ms
77,724 KB
testcase_24 AC 113 ms
77,780 KB
testcase_25 AC 151 ms
77,692 KB
testcase_26 AC 150 ms
77,612 KB
testcase_27 AC 223 ms
77,632 KB
testcase_28 AC 125 ms
77,620 KB
testcase_29 AC 125 ms
77,756 KB
testcase_30 AC 244 ms
77,948 KB
testcase_31 AC 123 ms
77,816 KB
testcase_32 AC 101 ms
77,248 KB
testcase_33 AC 199 ms
77,728 KB
testcase_34 AC 221 ms
77,628 KB
testcase_35 AC 129 ms
77,964 KB
testcase_36 AC 213 ms
77,872 KB
testcase_37 AC 136 ms
77,936 KB
testcase_38 AC 207 ms
77,856 KB
testcase_39 AC 113 ms
77,644 KB
testcase_40 AC 222 ms
77,648 KB
testcase_41 AC 229 ms
77,428 KB
testcase_42 AC 230 ms
77,756 KB
testcase_43 AC 228 ms
77,640 KB
testcase_44 AC 223 ms
77,644 KB
testcase_45 AC 228 ms
77,588 KB
testcase_46 AC 226 ms
78,192 KB
testcase_47 AC 224 ms
77,756 KB
testcase_48 AC 226 ms
77,636 KB
testcase_49 AC 232 ms
77,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.buffer.readline

    two_inv = (mod + 1) // 2
    for _ in range(int(input())):
        N, M, X = map(int, input().split())
        p = pow(1+M, N, mod)
        n = pow(1-M, N, mod)
        if X == 0:
            print(((p + n) * two_inv)%mod)
        else:
            print(((p - n) * two_inv)%mod)


if __name__ == '__main__':
    main()
0