結果

問題 No.1258 コインゲーム
ユーザー marroncastlemarroncastle
提出日時 2020-10-16 22:49:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 353 ms / 2,000 ms
コード長 262 bytes
コンパイル時間 553 ms
コンパイル使用メモリ 86,984 KB
実行使用メモリ 81,628 KB
最終ジャッジ日時 2023-09-28 04:37:21
合計ジャッジ時間 16,306 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
77,924 KB
testcase_01 AC 151 ms
78,656 KB
testcase_02 AC 118 ms
77,416 KB
testcase_03 AC 291 ms
80,876 KB
testcase_04 AC 317 ms
81,484 KB
testcase_05 AC 137 ms
77,744 KB
testcase_06 AC 258 ms
79,524 KB
testcase_07 AC 116 ms
77,476 KB
testcase_08 AC 106 ms
77,436 KB
testcase_09 AC 172 ms
79,056 KB
testcase_10 AC 293 ms
80,460 KB
testcase_11 AC 311 ms
81,064 KB
testcase_12 AC 251 ms
79,956 KB
testcase_13 AC 146 ms
77,936 KB
testcase_14 AC 110 ms
77,424 KB
testcase_15 AC 285 ms
80,688 KB
testcase_16 AC 131 ms
77,344 KB
testcase_17 AC 311 ms
81,088 KB
testcase_18 AC 176 ms
78,948 KB
testcase_19 AC 169 ms
79,016 KB
testcase_20 AC 264 ms
80,168 KB
testcase_21 AC 315 ms
80,744 KB
testcase_22 AC 241 ms
79,916 KB
testcase_23 AC 197 ms
78,664 KB
testcase_24 AC 135 ms
77,356 KB
testcase_25 AC 198 ms
78,844 KB
testcase_26 AC 178 ms
78,980 KB
testcase_27 AC 296 ms
80,788 KB
testcase_28 AC 147 ms
78,280 KB
testcase_29 AC 149 ms
78,128 KB
testcase_30 AC 341 ms
81,628 KB
testcase_31 AC 151 ms
78,628 KB
testcase_32 AC 119 ms
77,672 KB
testcase_33 AC 261 ms
80,160 KB
testcase_34 AC 302 ms
81,124 KB
testcase_35 AC 163 ms
78,884 KB
testcase_36 AC 298 ms
80,668 KB
testcase_37 AC 172 ms
78,760 KB
testcase_38 AC 283 ms
80,760 KB
testcase_39 AC 146 ms
78,032 KB
testcase_40 AC 338 ms
81,216 KB
testcase_41 AC 346 ms
81,152 KB
testcase_42 AC 341 ms
81,124 KB
testcase_43 AC 344 ms
81,256 KB
testcase_44 AC 335 ms
81,312 KB
testcase_45 AC 353 ms
81,224 KB
testcase_46 AC 332 ms
80,904 KB
testcase_47 AC 343 ms
81,340 KB
testcase_48 AC 341 ms
81,392 KB
testcase_49 AC 344 ms
81,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = int(input())
ans = [0]*S
mod = 10**9+7
for s in range(S):
  N, M, X = map(int, input().split())
  A = pow(1+M,N,mod)
  B = pow(1-M,N,mod)
  if X==0:
    ans[s] = (A+B)*pow(2,mod-2,mod)%mod
  else:
    ans[s] = (A-B)*pow(2,mod-2,mod)%mod
print(*ans, sep='\n')
0