結果

問題 No.1258 コインゲーム
ユーザー qibqib
提出日時 2023-05-08 12:12:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 561 ms / 2,000 ms
コード長 239 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 77,440 KB
最終ジャッジ日時 2024-05-04 00:09:36
合計ジャッジ時間 21,685 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 147 ms
76,800 KB
testcase_01 AC 170 ms
77,184 KB
testcase_02 AC 110 ms
77,056 KB
testcase_03 AC 409 ms
77,132 KB
testcase_04 AC 442 ms
77,312 KB
testcase_05 AC 131 ms
77,144 KB
testcase_06 AC 347 ms
77,364 KB
testcase_07 AC 112 ms
76,828 KB
testcase_08 AC 111 ms
77,440 KB
testcase_09 AC 221 ms
77,352 KB
testcase_10 AC 409 ms
76,968 KB
testcase_11 AC 420 ms
77,256 KB
testcase_12 AC 330 ms
76,928 KB
testcase_13 AC 167 ms
77,184 KB
testcase_14 AC 124 ms
77,272 KB
testcase_15 AC 438 ms
76,928 KB
testcase_16 AC 135 ms
77,312 KB
testcase_17 AC 420 ms
77,124 KB
testcase_18 AC 206 ms
77,152 KB
testcase_19 AC 188 ms
77,056 KB
testcase_20 AC 337 ms
76,928 KB
testcase_21 AC 400 ms
77,056 KB
testcase_22 AC 304 ms
76,928 KB
testcase_23 AC 240 ms
77,440 KB
testcase_24 AC 135 ms
77,312 KB
testcase_25 AC 234 ms
77,184 KB
testcase_26 AC 208 ms
77,020 KB
testcase_27 AC 411 ms
77,124 KB
testcase_28 AC 158 ms
76,984 KB
testcase_29 AC 158 ms
77,020 KB
testcase_30 AC 484 ms
77,084 KB
testcase_31 AC 195 ms
76,928 KB
testcase_32 AC 131 ms
76,800 KB
testcase_33 AC 359 ms
76,920 KB
testcase_34 AC 424 ms
76,928 KB
testcase_35 AC 185 ms
77,056 KB
testcase_36 AC 406 ms
76,928 KB
testcase_37 AC 228 ms
77,312 KB
testcase_38 AC 427 ms
77,312 KB
testcase_39 AC 160 ms
77,184 KB
testcase_40 AC 471 ms
77,184 KB
testcase_41 AC 525 ms
77,184 KB
testcase_42 AC 468 ms
77,176 KB
testcase_43 AC 478 ms
76,928 KB
testcase_44 AC 536 ms
77,184 KB
testcase_45 AC 523 ms
76,928 KB
testcase_46 AC 561 ms
77,140 KB
testcase_47 AC 547 ms
77,168 KB
testcase_48 AC 531 ms
77,184 KB
testcase_49 AC 470 ms
76,928 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