結果

問題 No.1258 コインゲーム
ユーザー trineutrontrineutron
提出日時 2020-10-16 21:47:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,482 ms / 2,000 ms
コード長 245 bytes
コンパイル時間 356 ms
コンパイル使用メモリ 10,660 KB
実行使用メモリ 8,000 KB
最終ジャッジ日時 2023-09-28 02:46:32
合計ジャッジ時間 45,241 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 275 ms
7,864 KB
testcase_01 AC 350 ms
7,804 KB
testcase_02 AC 137 ms
7,848 KB
testcase_03 AC 1,134 ms
7,804 KB
testcase_04 AC 1,271 ms
7,852 KB
testcase_05 AC 212 ms
7,908 KB
testcase_06 AC 934 ms
7,784 KB
testcase_07 AC 101 ms
7,796 KB
testcase_08 AC 89 ms
7,800 KB
testcase_09 AC 465 ms
7,764 KB
testcase_10 AC 1,131 ms
7,804 KB
testcase_11 AC 1,241 ms
7,912 KB
testcase_12 AC 896 ms
7,880 KB
testcase_13 AC 286 ms
7,900 KB
testcase_14 AC 97 ms
7,724 KB
testcase_15 AC 1,085 ms
7,852 KB
testcase_16 AC 231 ms
7,840 KB
testcase_17 AC 1,236 ms
7,880 KB
testcase_18 AC 467 ms
7,800 KB
testcase_19 AC 435 ms
7,792 KB
testcase_20 AC 902 ms
7,796 KB
testcase_21 AC 1,182 ms
7,768 KB
testcase_22 AC 825 ms
7,848 KB
testcase_23 AC 602 ms
7,884 KB
testcase_24 AC 230 ms
7,792 KB
testcase_25 AC 569 ms
8,000 KB
testcase_26 AC 500 ms
7,720 KB
testcase_27 AC 1,121 ms
7,796 KB
testcase_28 AC 300 ms
7,720 KB
testcase_29 AC 319 ms
7,848 KB
testcase_30 AC 1,394 ms
7,968 KB
testcase_31 AC 351 ms
7,720 KB
testcase_32 AC 165 ms
7,968 KB
testcase_33 AC 940 ms
7,844 KB
testcase_34 AC 1,150 ms
7,996 KB
testcase_35 AC 414 ms
7,968 KB
testcase_36 AC 1,148 ms
7,800 KB
testcase_37 AC 444 ms
7,816 KB
testcase_38 AC 1,058 ms
7,952 KB
testcase_39 AC 301 ms
7,724 KB
testcase_40 AC 1,448 ms
7,804 KB
testcase_41 AC 1,400 ms
7,964 KB
testcase_42 AC 1,453 ms
7,952 KB
testcase_43 AC 1,421 ms
7,796 KB
testcase_44 AC 1,435 ms
7,864 KB
testcase_45 AC 1,438 ms
7,904 KB
testcase_46 AC 1,482 ms
7,864 KB
testcase_47 AC 1,454 ms
7,796 KB
testcase_48 AC 1,452 ms
7,900 KB
testcase_49 AC 1,436 ms
7,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9 + 7

def solve():
    n, m, x = map(int, input().split())
    t = pow(m + 1, n, mod)
    d = pow(m - 1, n, mod)
    print((t + (1 - (x + n) % 2 * 2) * d) * pow(2, mod - 2, mod) % mod)

s = int(input())
for i in range(s):
    solve()
0