結果

問題 No.1258 コインゲーム
ユーザー tanon710tanon710
提出日時 2020-10-17 00:45:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 508 ms / 2,000 ms
コード長 267 bytes
コンパイル時間 944 ms
コンパイル使用メモリ 87,336 KB
実行使用メモリ 79,732 KB
最終ジャッジ日時 2023-09-28 07:08:15
合計ジャッジ時間 21,027 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 198 ms
79,540 KB
testcase_01 AC 209 ms
79,608 KB
testcase_02 AC 149 ms
78,832 KB
testcase_03 AC 417 ms
79,704 KB
testcase_04 AC 465 ms
79,624 KB
testcase_05 AC 173 ms
79,112 KB
testcase_06 AC 369 ms
79,208 KB
testcase_07 AC 142 ms
79,208 KB
testcase_08 AC 132 ms
78,820 KB
testcase_09 AC 236 ms
79,124 KB
testcase_10 AC 412 ms
79,200 KB
testcase_11 AC 445 ms
79,172 KB
testcase_12 AC 364 ms
79,168 KB
testcase_13 AC 189 ms
79,168 KB
testcase_14 AC 143 ms
79,280 KB
testcase_15 AC 413 ms
79,200 KB
testcase_16 AC 179 ms
79,164 KB
testcase_17 AC 458 ms
79,592 KB
testcase_18 AC 234 ms
79,100 KB
testcase_19 AC 231 ms
79,584 KB
testcase_20 AC 362 ms
79,532 KB
testcase_21 AC 428 ms
79,212 KB
testcase_22 AC 339 ms
78,968 KB
testcase_23 AC 277 ms
79,124 KB
testcase_24 AC 174 ms
79,212 KB
testcase_25 AC 269 ms
79,536 KB
testcase_26 AC 250 ms
79,428 KB
testcase_27 AC 421 ms
79,448 KB
testcase_28 AC 196 ms
79,532 KB
testcase_29 AC 207 ms
79,488 KB
testcase_30 AC 508 ms
79,020 KB
testcase_31 AC 212 ms
79,144 KB
testcase_32 AC 160 ms
78,908 KB
testcase_33 AC 363 ms
79,212 KB
testcase_34 AC 441 ms
79,560 KB
testcase_35 AC 222 ms
79,204 KB
testcase_36 AC 416 ms
79,216 KB
testcase_37 AC 235 ms
79,484 KB
testcase_38 AC 438 ms
79,732 KB
testcase_39 AC 196 ms
79,592 KB
testcase_40 AC 476 ms
79,212 KB
testcase_41 AC 464 ms
79,256 KB
testcase_42 AC 486 ms
79,236 KB
testcase_43 AC 485 ms
79,164 KB
testcase_44 AC 492 ms
79,280 KB
testcase_45 AC 473 ms
79,080 KB
testcase_46 AC 492 ms
78,992 KB
testcase_47 AC 499 ms
79,024 KB
testcase_48 AC 488 ms
79,588 KB
testcase_49 AC 498 ms
79,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=10**9+7

t=int(input())
for _ in range(t):
    n,m,x=map(int,input().split())
    if (x==0 and n%2==0) or (x==1 and n%2==1):
        ans=pow(m+1,n,mod)+pow(m-1,n,mod)
    else:
        ans=pow(m+1,n,mod)-pow(m-1,n,mod)
    ans*=pow(2,mod-2,mod)
    print(ans%mod)
0