結果

問題 No.1258 コインゲーム
ユーザー kojihashimoto-kobekojihashimoto-kobe
提出日時 2023-04-12 00:29:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 543 ms / 2,000 ms
コード長 230 bytes
コンパイル時間 395 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 78,200 KB
最終ジャッジ日時 2024-04-16 19:12:09
合計ジャッジ時間 22,304 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 171 ms
76,428 KB
testcase_01 AC 192 ms
76,212 KB
testcase_02 AC 127 ms
76,216 KB
testcase_03 AC 438 ms
76,288 KB
testcase_04 AC 483 ms
76,344 KB
testcase_05 AC 151 ms
76,276 KB
testcase_06 AC 373 ms
76,236 KB
testcase_07 AC 121 ms
76,212 KB
testcase_08 AC 113 ms
76,672 KB
testcase_09 AC 228 ms
76,116 KB
testcase_10 AC 446 ms
75,956 KB
testcase_11 AC 493 ms
76,180 KB
testcase_12 AC 392 ms
76,100 KB
testcase_13 AC 179 ms
76,128 KB
testcase_14 AC 121 ms
76,640 KB
testcase_15 AC 432 ms
76,232 KB
testcase_16 AC 154 ms
76,416 KB
testcase_17 AC 472 ms
76,292 KB
testcase_18 AC 232 ms
76,288 KB
testcase_19 AC 220 ms
76,544 KB
testcase_20 AC 372 ms
76,800 KB
testcase_21 AC 447 ms
76,288 KB
testcase_22 AC 345 ms
76,028 KB
testcase_23 AC 277 ms
76,108 KB
testcase_24 AC 162 ms
76,544 KB
testcase_25 AC 267 ms
76,672 KB
testcase_26 AC 240 ms
76,096 KB
testcase_27 AC 437 ms
76,288 KB
testcase_28 AC 182 ms
76,408 KB
testcase_29 AC 187 ms
76,612 KB
testcase_30 AC 526 ms
76,800 KB
testcase_31 AC 194 ms
76,064 KB
testcase_32 AC 135 ms
76,152 KB
testcase_33 AC 379 ms
76,544 KB
testcase_34 AC 446 ms
76,216 KB
testcase_35 AC 212 ms
76,416 KB
testcase_36 AC 441 ms
76,120 KB
testcase_37 AC 228 ms
76,416 KB
testcase_38 AC 418 ms
76,188 KB
testcase_39 AC 186 ms
75,968 KB
testcase_40 AC 527 ms
78,068 KB
testcase_41 AC 530 ms
77,452 KB
testcase_42 AC 531 ms
78,200 KB
testcase_43 AC 543 ms
77,568 KB
testcase_44 AC 537 ms
77,824 KB
testcase_45 AC 532 ms
77,568 KB
testcase_46 AC 533 ms
77,696 KB
testcase_47 AC 527 ms
77,456 KB
testcase_48 AC 530 ms
77,568 KB
testcase_49 AC 540 ms
77,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s=int(input())
mod=10**9+7
for _ in range(s):
  n,m,x = map(int, input().split())
  t = pow(1+m,n,mod)
  u = pow(1-m,n,mod)
  if x == 0:
    ans = (t+u)*pow(2,mod-2,mod)
  else:
    ans = (t-u)*pow(2,mod-2,mod)
  
  print(ans%mod)
0