結果

問題 No.1258 コインゲーム
ユーザー hir355hir355
提出日時 2020-10-16 23:06:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 558 ms / 2,000 ms
コード長 336 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 87,240 KB
実行使用メモリ 79,596 KB
最終ジャッジ日時 2023-09-28 05:05:34
合計ジャッジ時間 23,216 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 217 ms
79,400 KB
testcase_01 AC 241 ms
79,492 KB
testcase_02 AC 170 ms
78,728 KB
testcase_03 AC 475 ms
79,316 KB
testcase_04 AC 522 ms
79,432 KB
testcase_05 AC 192 ms
78,992 KB
testcase_06 AC 411 ms
78,864 KB
testcase_07 AC 166 ms
79,092 KB
testcase_08 AC 156 ms
78,740 KB
testcase_09 AC 273 ms
79,112 KB
testcase_10 AC 469 ms
79,284 KB
testcase_11 AC 509 ms
79,132 KB
testcase_12 AC 409 ms
78,988 KB
testcase_13 AC 220 ms
79,096 KB
testcase_14 AC 172 ms
79,404 KB
testcase_15 AC 471 ms
79,088 KB
testcase_16 AC 202 ms
79,200 KB
testcase_17 AC 515 ms
79,348 KB
testcase_18 AC 273 ms
79,216 KB
testcase_19 AC 268 ms
79,596 KB
testcase_20 AC 415 ms
79,352 KB
testcase_21 AC 493 ms
79,084 KB
testcase_22 AC 379 ms
79,116 KB
testcase_23 AC 313 ms
79,132 KB
testcase_24 AC 202 ms
79,168 KB
testcase_25 AC 309 ms
79,148 KB
testcase_26 AC 284 ms
79,332 KB
testcase_27 AC 473 ms
78,896 KB
testcase_28 AC 226 ms
79,360 KB
testcase_29 AC 235 ms
79,508 KB
testcase_30 AC 555 ms
79,112 KB
testcase_31 AC 242 ms
78,972 KB
testcase_32 AC 181 ms
78,708 KB
testcase_33 AC 424 ms
79,124 KB
testcase_34 AC 493 ms
79,144 KB
testcase_35 AC 253 ms
78,940 KB
testcase_36 AC 478 ms
79,200 KB
testcase_37 AC 273 ms
79,264 KB
testcase_38 AC 458 ms
79,140 KB
testcase_39 AC 230 ms
79,416 KB
testcase_40 AC 541 ms
78,964 KB
testcase_41 AC 542 ms
78,932 KB
testcase_42 AC 545 ms
79,128 KB
testcase_43 AC 539 ms
79,048 KB
testcase_44 AC 558 ms
79,212 KB
testcase_45 AC 544 ms
79,084 KB
testcase_46 AC 542 ms
79,152 KB
testcase_47 AC 539 ms
79,104 KB
testcase_48 AC 538 ms
78,964 KB
testcase_49 AC 549 ms
79,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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