結果

問題 No.1258 コインゲーム
ユーザー KudeKude
提出日時 2020-10-16 22:33:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 449 ms / 2,000 ms
コード長 279 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 79,400 KB
最終ジャッジ日時 2023-09-28 04:18:38
合計ジャッジ時間 18,686 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 174 ms
78,912 KB
testcase_01 AC 199 ms
79,032 KB
testcase_02 AC 144 ms
78,708 KB
testcase_03 AC 370 ms
78,956 KB
testcase_04 AC 412 ms
79,104 KB
testcase_05 AC 160 ms
78,620 KB
testcase_06 AC 323 ms
78,860 KB
testcase_07 AC 132 ms
78,688 KB
testcase_08 AC 129 ms
78,604 KB
testcase_09 AC 223 ms
79,100 KB
testcase_10 AC 372 ms
78,892 KB
testcase_11 AC 398 ms
78,904 KB
testcase_12 AC 330 ms
78,704 KB
testcase_13 AC 186 ms
79,400 KB
testcase_14 AC 132 ms
78,680 KB
testcase_15 AC 373 ms
78,952 KB
testcase_16 AC 161 ms
78,624 KB
testcase_17 AC 405 ms
78,904 KB
testcase_18 AC 223 ms
78,848 KB
testcase_19 AC 215 ms
78,972 KB
testcase_20 AC 326 ms
79,020 KB
testcase_21 AC 383 ms
78,860 KB
testcase_22 AC 309 ms
78,700 KB
testcase_23 AC 250 ms
78,952 KB
testcase_24 AC 167 ms
78,700 KB
testcase_25 AC 251 ms
79,008 KB
testcase_26 AC 227 ms
78,572 KB
testcase_27 AC 365 ms
78,916 KB
testcase_28 AC 183 ms
79,044 KB
testcase_29 AC 187 ms
78,940 KB
testcase_30 AC 436 ms
79,016 KB
testcase_31 AC 194 ms
79,064 KB
testcase_32 AC 156 ms
78,356 KB
testcase_33 AC 339 ms
79,172 KB
testcase_34 AC 382 ms
79,008 KB
testcase_35 AC 217 ms
78,896 KB
testcase_36 AC 389 ms
79,112 KB
testcase_37 AC 215 ms
78,916 KB
testcase_38 AC 362 ms
78,964 KB
testcase_39 AC 181 ms
78,960 KB
testcase_40 AC 428 ms
78,912 KB
testcase_41 AC 434 ms
78,860 KB
testcase_42 AC 436 ms
78,844 KB
testcase_43 AC 441 ms
78,888 KB
testcase_44 AC 438 ms
78,772 KB
testcase_45 AC 449 ms
78,500 KB
testcase_46 AC 440 ms
78,788 KB
testcase_47 AC 431 ms
78,796 KB
testcase_48 AC 426 ms
78,972 KB
testcase_49 AC 430 ms
78,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7
inv2 = (MOD + 1) // 2
for _ in range(int(input())):
    n, m, x = map(int, input().split())
    s = pow(m + 1, n, MOD)
    t = pow(m - 1, n, MOD)
    if n % 2 == 1:
        t = -t
    ans = (s + t) * inv2 % MOD if x == 0 else (s - t) * inv2 % MOD
    print(ans)
0