結果

問題 No.1258 コインゲーム
ユーザー qibqib
提出日時 2023-05-08 12:12:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 542 ms / 2,000 ms
コード長 239 bytes
コンパイル時間 812 ms
コンパイル使用メモリ 86,836 KB
実行使用メモリ 78,980 KB
最終ジャッジ日時 2023-08-16 16:00:17
合計ジャッジ時間 27,643 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 195 ms
77,920 KB
testcase_01 AC 211 ms
77,976 KB
testcase_02 AC 150 ms
78,092 KB
testcase_03 AC 458 ms
78,192 KB
testcase_04 AC 494 ms
78,288 KB
testcase_05 AC 176 ms
77,932 KB
testcase_06 AC 389 ms
78,488 KB
testcase_07 AC 140 ms
78,100 KB
testcase_08 AC 133 ms
77,724 KB
testcase_09 AC 252 ms
78,100 KB
testcase_10 AC 436 ms
78,016 KB
testcase_11 AC 490 ms
78,276 KB
testcase_12 AC 389 ms
78,316 KB
testcase_13 AC 195 ms
78,168 KB
testcase_14 AC 139 ms
78,136 KB
testcase_15 AC 442 ms
78,240 KB
testcase_16 AC 177 ms
77,976 KB
testcase_17 AC 485 ms
78,236 KB
testcase_18 AC 253 ms
78,376 KB
testcase_19 AC 242 ms
78,284 KB
testcase_20 AC 392 ms
78,164 KB
testcase_21 AC 473 ms
78,284 KB
testcase_22 AC 364 ms
78,204 KB
testcase_23 AC 298 ms
78,388 KB
testcase_24 AC 182 ms
78,404 KB
testcase_25 AC 284 ms
78,408 KB
testcase_26 AC 263 ms
78,280 KB
testcase_27 AC 461 ms
78,000 KB
testcase_28 AC 212 ms
77,928 KB
testcase_29 AC 212 ms
78,028 KB
testcase_30 AC 531 ms
78,336 KB
testcase_31 AC 220 ms
78,032 KB
testcase_32 AC 159 ms
78,088 KB
testcase_33 AC 396 ms
78,400 KB
testcase_34 AC 476 ms
78,172 KB
testcase_35 AC 238 ms
78,324 KB
testcase_36 AC 454 ms
78,272 KB
testcase_37 AC 248 ms
78,492 KB
testcase_38 AC 444 ms
78,492 KB
testcase_39 AC 206 ms
78,076 KB
testcase_40 AC 542 ms
78,524 KB
testcase_41 AC 534 ms
78,528 KB
testcase_42 AC 534 ms
78,224 KB
testcase_43 AC 533 ms
78,608 KB
testcase_44 AC 540 ms
78,672 KB
testcase_45 AC 541 ms
78,676 KB
testcase_46 AC 529 ms
78,688 KB
testcase_47 AC 534 ms
78,768 KB
testcase_48 AC 539 ms
78,688 KB
testcase_49 AC 538 ms
78,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7

s = int(input())

sgn = [1, -1]

for _ in range(s):
  n, m, x = map(int, input().split())
  i2 = pow(2, MOD - 2, MOD)
  ans = (pow(1 + m, n, MOD) + sgn[x] * pow(1 - m, n, MOD)) % MOD
  ans = (ans * i2) % MOD
  print(ans)
0