結果

問題 No.1258 コインゲーム
ユーザー titiatitia
提出日時 2022-06-15 01:18:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,913 ms / 2,000 ms
コード長 249 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-14 07:18:06
合計ジャッジ時間 58,997 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 380 ms
10,752 KB
testcase_01 AC 478 ms
10,752 KB
testcase_02 AC 189 ms
10,752 KB
testcase_03 AC 1,464 ms
10,752 KB
testcase_04 AC 1,694 ms
10,752 KB
testcase_05 AC 293 ms
10,880 KB
testcase_06 AC 1,239 ms
10,752 KB
testcase_07 AC 147 ms
10,624 KB
testcase_08 AC 129 ms
10,624 KB
testcase_09 AC 616 ms
10,624 KB
testcase_10 AC 1,473 ms
10,752 KB
testcase_11 AC 1,636 ms
10,752 KB
testcase_12 AC 1,211 ms
10,752 KB
testcase_13 AC 391 ms
10,752 KB
testcase_14 AC 146 ms
10,752 KB
testcase_15 AC 1,426 ms
10,752 KB
testcase_16 AC 305 ms
10,624 KB
testcase_17 AC 1,628 ms
10,752 KB
testcase_18 AC 608 ms
10,624 KB
testcase_19 AC 562 ms
10,624 KB
testcase_20 AC 1,208 ms
10,752 KB
testcase_21 AC 1,516 ms
10,752 KB
testcase_22 AC 1,066 ms
10,752 KB
testcase_23 AC 804 ms
10,752 KB
testcase_24 AC 311 ms
10,752 KB
testcase_25 AC 761 ms
10,752 KB
testcase_26 AC 649 ms
10,752 KB
testcase_27 AC 1,487 ms
10,752 KB
testcase_28 AC 402 ms
10,624 KB
testcase_29 AC 439 ms
10,752 KB
testcase_30 AC 1,862 ms
10,752 KB
testcase_31 AC 478 ms
10,752 KB
testcase_32 AC 222 ms
10,752 KB
testcase_33 AC 1,238 ms
10,752 KB
testcase_34 AC 1,544 ms
10,752 KB
testcase_35 AC 552 ms
10,880 KB
testcase_36 AC 1,509 ms
10,880 KB
testcase_37 AC 594 ms
10,624 KB
testcase_38 AC 1,426 ms
10,752 KB
testcase_39 AC 414 ms
10,752 KB
testcase_40 AC 1,911 ms
10,624 KB
testcase_41 AC 1,912 ms
10,752 KB
testcase_42 AC 1,895 ms
10,624 KB
testcase_43 AC 1,913 ms
10,624 KB
testcase_44 AC 1,884 ms
10,752 KB
testcase_45 AC 1,908 ms
10,752 KB
testcase_46 AC 1,897 ms
10,752 KB
testcase_47 AC 1,887 ms
10,880 KB
testcase_48 AC 1,898 ms
10,752 KB
testcase_49 AC 1,902 ms
10,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=10**9+7

T=int(input())
for tests in range(T):
    N,M,X=map(int,input().split())

    ALL=pow(1+M,N,mod)
    H=pow(-1+M,N,mod)

    if (X+N)%2==0:
        print((ALL+H)*pow(2,mod-2,mod)%mod)
    else:
        print((ALL-H)*pow(2,mod-2,mod)%mod)
0