結果

問題 No.1258 コインゲーム
ユーザー anagohirameanagohirame
提出日時 2020-10-16 22:00:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 248 ms / 2,000 ms
コード長 311 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 78,188 KB
最終ジャッジ日時 2023-09-28 03:04:48
合計ジャッジ時間 13,176 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
77,528 KB
testcase_01 AC 124 ms
77,620 KB
testcase_02 AC 101 ms
77,412 KB
testcase_03 AC 212 ms
77,504 KB
testcase_04 AC 229 ms
77,528 KB
testcase_05 AC 112 ms
77,440 KB
testcase_06 AC 192 ms
77,500 KB
testcase_07 AC 96 ms
76,736 KB
testcase_08 AC 97 ms
76,916 KB
testcase_09 AC 136 ms
77,776 KB
testcase_10 AC 210 ms
77,236 KB
testcase_11 AC 224 ms
77,848 KB
testcase_12 AC 197 ms
77,404 KB
testcase_13 AC 115 ms
77,372 KB
testcase_14 AC 94 ms
76,968 KB
testcase_15 AC 207 ms
77,464 KB
testcase_16 AC 111 ms
77,576 KB
testcase_17 AC 230 ms
77,548 KB
testcase_18 AC 139 ms
77,736 KB
testcase_19 AC 138 ms
77,580 KB
testcase_20 AC 189 ms
77,664 KB
testcase_21 AC 216 ms
77,560 KB
testcase_22 AC 181 ms
77,432 KB
testcase_23 AC 157 ms
77,532 KB
testcase_24 AC 109 ms
77,324 KB
testcase_25 AC 153 ms
77,456 KB
testcase_26 AC 143 ms
77,496 KB
testcase_27 AC 226 ms
77,240 KB
testcase_28 AC 121 ms
77,464 KB
testcase_29 AC 121 ms
77,524 KB
testcase_30 AC 248 ms
77,480 KB
testcase_31 AC 123 ms
77,620 KB
testcase_32 AC 99 ms
76,656 KB
testcase_33 AC 191 ms
77,424 KB
testcase_34 AC 222 ms
77,440 KB
testcase_35 AC 130 ms
77,568 KB
testcase_36 AC 214 ms
77,504 KB
testcase_37 AC 138 ms
77,356 KB
testcase_38 AC 207 ms
77,628 KB
testcase_39 AC 121 ms
77,528 KB
testcase_40 AC 244 ms
77,428 KB
testcase_41 AC 244 ms
77,788 KB
testcase_42 AC 241 ms
78,188 KB
testcase_43 AC 236 ms
77,612 KB
testcase_44 AC 239 ms
77,784 KB
testcase_45 AC 241 ms
77,632 KB
testcase_46 AC 241 ms
77,620 KB
testcase_47 AC 238 ms
78,096 KB
testcase_48 AC 245 ms
78,156 KB
testcase_49 AC 245 ms
78,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def input():
	return sys.stdin.buffer.readline()[:-1]

MOD = 10**9+7
HALF = pow(2, MOD-2, MOD)
for _ in range(int(input())):
	n, m, k = map(int, input().split())
	if k == 0:
		print((pow(1+m, n, MOD) + pow(1-m, n, MOD)) * HALF % MOD)
	else:
		print((pow(1+m, n, MOD) - pow(1-m, n, MOD)) * HALF % MOD)
0