結果

問題 No.1258 コインゲーム
ユーザー mlihua09mlihua09
提出日時 2020-10-16 22:16:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 476 ms / 2,000 ms
コード長 306 bytes
コンパイル時間 2,001 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 79,180 KB
最終ジャッジ日時 2023-09-28 03:31:53
合計ジャッジ時間 19,914 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 178 ms
78,768 KB
testcase_01 AC 203 ms
78,508 KB
testcase_02 AC 145 ms
78,476 KB
testcase_03 AC 398 ms
78,780 KB
testcase_04 AC 440 ms
78,996 KB
testcase_05 AC 160 ms
78,652 KB
testcase_06 AC 357 ms
78,832 KB
testcase_07 AC 138 ms
78,784 KB
testcase_08 AC 129 ms
78,584 KB
testcase_09 AC 225 ms
78,728 KB
testcase_10 AC 406 ms
78,776 KB
testcase_11 AC 428 ms
78,772 KB
testcase_12 AC 342 ms
78,488 KB
testcase_13 AC 176 ms
78,728 KB
testcase_14 AC 133 ms
78,752 KB
testcase_15 AC 382 ms
78,628 KB
testcase_16 AC 167 ms
78,540 KB
testcase_17 AC 418 ms
78,828 KB
testcase_18 AC 228 ms
78,780 KB
testcase_19 AC 221 ms
78,948 KB
testcase_20 AC 340 ms
78,684 KB
testcase_21 AC 403 ms
78,672 KB
testcase_22 AC 314 ms
78,864 KB
testcase_23 AC 263 ms
78,764 KB
testcase_24 AC 169 ms
78,608 KB
testcase_25 AC 254 ms
78,684 KB
testcase_26 AC 234 ms
78,900 KB
testcase_27 AC 405 ms
78,632 KB
testcase_28 AC 187 ms
78,788 KB
testcase_29 AC 191 ms
78,712 KB
testcase_30 AC 470 ms
78,640 KB
testcase_31 AC 195 ms
78,580 KB
testcase_32 AC 150 ms
78,724 KB
testcase_33 AC 341 ms
78,900 KB
testcase_34 AC 405 ms
78,688 KB
testcase_35 AC 210 ms
78,820 KB
testcase_36 AC 403 ms
78,672 KB
testcase_37 AC 227 ms
78,892 KB
testcase_38 AC 385 ms
78,844 KB
testcase_39 AC 188 ms
78,684 KB
testcase_40 AC 468 ms
79,144 KB
testcase_41 AC 469 ms
78,940 KB
testcase_42 AC 470 ms
79,180 KB
testcase_43 AC 467 ms
78,844 KB
testcase_44 AC 472 ms
78,876 KB
testcase_45 AC 469 ms
79,080 KB
testcase_46 AC 461 ms
78,992 KB
testcase_47 AC 466 ms
78,656 KB
testcase_48 AC 476 ms
78,940 KB
testcase_49 AC 470 ms
79,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10 ** 9 + 7

for _ in range(int(input())):
    
    N, M, X = map(int, input().split())
    
    if X:
        
        print((pow(M + 1, N, mod) - pow(1 - M, N, mod)) * (mod + 1) // 2 % mod)
        
    else:
        
        print((pow(M + 1, N, mod) + pow(1 - M, N, mod)) * (mod + 1) // 2 % mod)
0