結果

問題 No.1258 コインゲーム
ユーザー kozykozy
提出日時 2020-10-16 22:14:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,358 ms / 2,000 ms
コード長 272 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 10,700 KB
実行使用メモリ 7,976 KB
最終ジャッジ日時 2023-09-28 03:31:26
合計ジャッジ時間 41,448 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 263 ms
7,880 KB
testcase_01 AC 326 ms
7,916 KB
testcase_02 AC 129 ms
7,856 KB
testcase_03 AC 1,055 ms
7,772 KB
testcase_04 AC 1,187 ms
7,780 KB
testcase_05 AC 206 ms
7,824 KB
testcase_06 AC 887 ms
7,940 KB
testcase_07 AC 99 ms
7,768 KB
testcase_08 AC 86 ms
7,848 KB
testcase_09 AC 447 ms
7,768 KB
testcase_10 AC 1,044 ms
7,968 KB
testcase_11 AC 1,163 ms
7,908 KB
testcase_12 AC 854 ms
7,804 KB
testcase_13 AC 266 ms
7,860 KB
testcase_14 AC 95 ms
7,884 KB
testcase_15 AC 1,035 ms
7,768 KB
testcase_16 AC 213 ms
7,772 KB
testcase_17 AC 1,164 ms
7,788 KB
testcase_18 AC 437 ms
7,836 KB
testcase_19 AC 400 ms
7,880 KB
testcase_20 AC 867 ms
7,856 KB
testcase_21 AC 1,098 ms
7,796 KB
testcase_22 AC 783 ms
7,840 KB
testcase_23 AC 575 ms
7,768 KB
testcase_24 AC 221 ms
7,784 KB
testcase_25 AC 543 ms
7,784 KB
testcase_26 AC 460 ms
7,852 KB
testcase_27 AC 1,073 ms
7,840 KB
testcase_28 AC 284 ms
7,824 KB
testcase_29 AC 300 ms
7,780 KB
testcase_30 AC 1,333 ms
7,900 KB
testcase_31 AC 349 ms
7,852 KB
testcase_32 AC 158 ms
7,936 KB
testcase_33 AC 892 ms
7,920 KB
testcase_34 AC 1,111 ms
7,772 KB
testcase_35 AC 389 ms
7,820 KB
testcase_36 AC 1,057 ms
7,944 KB
testcase_37 AC 426 ms
7,788 KB
testcase_38 AC 1,023 ms
7,944 KB
testcase_39 AC 284 ms
7,880 KB
testcase_40 AC 1,335 ms
7,916 KB
testcase_41 AC 1,357 ms
7,944 KB
testcase_42 AC 1,352 ms
7,976 KB
testcase_43 AC 1,338 ms
7,796 KB
testcase_44 AC 1,358 ms
7,844 KB
testcase_45 AC 1,345 ms
7,848 KB
testcase_46 AC 1,332 ms
7,792 KB
testcase_47 AC 1,342 ms
7,944 KB
testcase_48 AC 1,337 ms
7,784 KB
testcase_49 AC 1,343 ms
7,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S=int(input())
mod=1000000007
for i in range(S):
    N,M,K=map(int,input().split())
    ans=pow((1+M),N,mod)+pow((1-M),N,mod)
    ans%=mod
    if ans%2==1:
      ans+=mod
    ans=ans//2
    if K==1:
      ans=pow((1+M),N,mod)-ans
      ans=ans%mod
    
    
    print(ans)
0