結果

問題 No.1258 コインゲーム
ユーザー AEnAEn
提出日時 2022-09-02 00:18:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 468 ms / 2,000 ms
コード長 272 bytes
コンパイル時間 1,890 ms
コンパイル使用メモリ 86,708 KB
実行使用メモリ 78,868 KB
最終ジャッジ日時 2023-08-09 09:46:43
合計ジャッジ時間 28,808 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 183 ms
78,080 KB
testcase_01 AC 200 ms
78,428 KB
testcase_02 AC 146 ms
78,244 KB
testcase_03 AC 402 ms
78,400 KB
testcase_04 AC 440 ms
78,408 KB
testcase_05 AC 164 ms
78,272 KB
testcase_06 AC 349 ms
78,424 KB
testcase_07 AC 142 ms
78,312 KB
testcase_08 AC 136 ms
77,952 KB
testcase_09 AC 225 ms
78,312 KB
testcase_10 AC 391 ms
78,408 KB
testcase_11 AC 426 ms
78,416 KB
testcase_12 AC 345 ms
78,424 KB
testcase_13 AC 182 ms
78,128 KB
testcase_14 AC 137 ms
78,160 KB
testcase_15 AC 379 ms
78,180 KB
testcase_16 AC 168 ms
78,212 KB
testcase_17 AC 412 ms
78,368 KB
testcase_18 AC 228 ms
78,352 KB
testcase_19 AC 217 ms
78,332 KB
testcase_20 AC 336 ms
78,428 KB
testcase_21 AC 406 ms
78,384 KB
testcase_22 AC 313 ms
78,512 KB
testcase_23 AC 264 ms
78,568 KB
testcase_24 AC 166 ms
78,104 KB
testcase_25 AC 258 ms
78,516 KB
testcase_26 AC 234 ms
78,256 KB
testcase_27 AC 393 ms
78,644 KB
testcase_28 AC 187 ms
78,332 KB
testcase_29 AC 198 ms
78,124 KB
testcase_30 AC 461 ms
78,656 KB
testcase_31 AC 203 ms
78,176 KB
testcase_32 AC 155 ms
78,140 KB
testcase_33 AC 345 ms
78,196 KB
testcase_34 AC 403 ms
78,532 KB
testcase_35 AC 215 ms
78,532 KB
testcase_36 AC 394 ms
78,424 KB
testcase_37 AC 224 ms
78,360 KB
testcase_38 AC 384 ms
78,396 KB
testcase_39 AC 197 ms
78,080 KB
testcase_40 AC 455 ms
78,348 KB
testcase_41 AC 460 ms
78,348 KB
testcase_42 AC 468 ms
78,868 KB
testcase_43 AC 460 ms
78,516 KB
testcase_44 AC 461 ms
78,604 KB
testcase_45 AC 455 ms
78,332 KB
testcase_46 AC 453 ms
78,508 KB
testcase_47 AC 459 ms
78,392 KB
testcase_48 AC 464 ms
78,640 KB
testcase_49 AC 459 ms
78,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = int(input())
mod = 10**9+7
inv = pow(2, mod-2, mod)
for i in range(S):
    N, M, X = map(int,input().split())
    a = pow(M+1, N, mod)
    b = pow(1-M, N, mod)
    c = (a+b)%mod
    c *= inv
    c %= mod
    if X==0:
        print(c)
    else:
        print((a-c)%mod)
0