結果

問題 No.1258 コインゲーム
ユーザー c-yanc-yan
提出日時 2020-10-17 00:25:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 884 ms / 2,000 ms
コード長 324 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 10,716 KB
実行使用メモリ 8,436 KB
最終ジャッジ日時 2023-09-28 07:06:13
合計ジャッジ時間 28,678 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 177 ms
7,876 KB
testcase_01 AC 223 ms
8,012 KB
testcase_02 AC 89 ms
7,788 KB
testcase_03 AC 691 ms
8,216 KB
testcase_04 AC 779 ms
8,344 KB
testcase_05 AC 137 ms
7,920 KB
testcase_06 AC 569 ms
8,380 KB
testcase_07 AC 68 ms
7,860 KB
testcase_08 AC 62 ms
7,860 KB
testcase_09 AC 284 ms
8,220 KB
testcase_10 AC 675 ms
8,300 KB
testcase_11 AC 760 ms
8,220 KB
testcase_12 AC 570 ms
8,424 KB
testcase_13 AC 183 ms
8,348 KB
testcase_14 AC 67 ms
7,852 KB
testcase_15 AC 668 ms
8,228 KB
testcase_16 AC 143 ms
7,920 KB
testcase_17 AC 749 ms
8,292 KB
testcase_18 AC 285 ms
7,824 KB
testcase_19 AC 264 ms
7,860 KB
testcase_20 AC 564 ms
8,224 KB
testcase_21 AC 712 ms
8,404 KB
testcase_22 AC 503 ms
8,352 KB
testcase_23 AC 370 ms
8,416 KB
testcase_24 AC 144 ms
7,824 KB
testcase_25 AC 351 ms
8,292 KB
testcase_26 AC 306 ms
8,220 KB
testcase_27 AC 688 ms
8,256 KB
testcase_28 AC 189 ms
7,912 KB
testcase_29 AC 202 ms
7,784 KB
testcase_30 AC 853 ms
8,220 KB
testcase_31 AC 218 ms
7,856 KB
testcase_32 AC 104 ms
7,828 KB
testcase_33 AC 584 ms
8,436 KB
testcase_34 AC 713 ms
8,256 KB
testcase_35 AC 255 ms
7,824 KB
testcase_36 AC 695 ms
8,388 KB
testcase_37 AC 277 ms
8,300 KB
testcase_38 AC 649 ms
8,344 KB
testcase_39 AC 193 ms
8,288 KB
testcase_40 AC 869 ms
8,256 KB
testcase_41 AC 877 ms
8,388 KB
testcase_42 AC 874 ms
8,344 KB
testcase_43 AC 869 ms
8,220 KB
testcase_44 AC 884 ms
8,228 KB
testcase_45 AC 862 ms
8,292 KB
testcase_46 AC 869 ms
8,312 KB
testcase_47 AC 877 ms
8,216 KB
testcase_48 AC 880 ms
8,220 KB
testcase_49 AC 872 ms
8,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin

readline = stdin.readline
m = 1000000007

S = int(readline())
div2 = pow(2, m - 2, m)
for _ in range(S):
    N, M, X = map(int, readline().split())
    a = pow(M + 1, N, m)
    b = pow(M - 1, N, m)
    if (N + X) % 2 == 0:
        print((a + b) * div2 % m)
    else:
        print((a - b) * div2 % m)
0