結果

問題 No.1258 コインゲーム
ユーザー yuruhiyayuruhiya
提出日時 2020-10-16 22:14:52
言語 Ruby
(3.3.0)
結果
AC  
実行時間 532 ms / 2,000 ms
コード長 177 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 11,328 KB
実行使用メモリ 15,468 KB
最終ジャッジ日時 2023-09-28 03:29:34
合計ジャッジ時間 19,988 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
15,452 KB
testcase_01 AC 168 ms
15,404 KB
testcase_02 AC 105 ms
15,360 KB
testcase_03 AC 396 ms
15,276 KB
testcase_04 AC 426 ms
15,332 KB
testcase_05 AC 128 ms
15,400 KB
testcase_06 AC 329 ms
15,324 KB
testcase_07 AC 94 ms
15,128 KB
testcase_08 AC 92 ms
15,156 KB
testcase_09 AC 202 ms
15,168 KB
testcase_10 AC 383 ms
15,408 KB
testcase_11 AC 427 ms
15,212 KB
testcase_12 AC 321 ms
15,460 KB
testcase_13 AC 148 ms
15,436 KB
testcase_14 AC 95 ms
15,420 KB
testcase_15 AC 376 ms
15,244 KB
testcase_16 AC 135 ms
15,240 KB
testcase_17 AC 440 ms
15,360 KB
testcase_18 AC 196 ms
15,264 KB
testcase_19 AC 188 ms
15,292 KB
testcase_20 AC 332 ms
15,424 KB
testcase_21 AC 403 ms
15,156 KB
testcase_22 AC 295 ms
15,292 KB
testcase_23 AC 236 ms
15,416 KB
testcase_24 AC 131 ms
15,264 KB
testcase_25 AC 234 ms
15,404 KB
testcase_26 AC 208 ms
15,292 KB
testcase_27 AC 391 ms
15,248 KB
testcase_28 AC 152 ms
15,140 KB
testcase_29 AC 163 ms
15,336 KB
testcase_30 AC 469 ms
15,408 KB
testcase_31 AC 172 ms
15,404 KB
testcase_32 AC 115 ms
15,272 KB
testcase_33 AC 336 ms
15,400 KB
testcase_34 AC 405 ms
15,424 KB
testcase_35 AC 190 ms
15,128 KB
testcase_36 AC 395 ms
15,092 KB
testcase_37 AC 195 ms
15,164 KB
testcase_38 AC 379 ms
15,396 KB
testcase_39 AC 155 ms
15,152 KB
testcase_40 AC 477 ms
15,264 KB
testcase_41 AC 472 ms
15,260 KB
testcase_42 AC 490 ms
15,296 KB
testcase_43 AC 488 ms
15,468 KB
testcase_44 AC 532 ms
15,400 KB
testcase_45 AC 474 ms
15,412 KB
testcase_46 AC 476 ms
15,392 KB
testcase_47 AC 478 ms
15,240 KB
testcase_48 AC 484 ms
15,248 KB
testcase_49 AC 479 ms
15,304 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

MOD = 10**9 + 7
gets.to_i.times {
	n, m, k = gets.split.map(&:to_i)
	x, y = (1 + m).pow(n, MOD), (1 - m).pow(n, MOD)
	puts (k == 0 ? x + y : x - y) * 2.pow(MOD - 2, MOD) % MOD
}
0