結果

問題 No.1258 コインゲーム
ユーザー jensenjensen
提出日時 2021-01-09 13:45:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,166 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 10,636 KB
実行使用メモリ 51,220 KB
最終ジャッジ日時 2023-08-11 04:10:48
合計ジャッジ時間 37,553 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 214 ms
16,064 KB
testcase_01 AC 273 ms
18,464 KB
testcase_02 AC 106 ms
11,820 KB
testcase_03 AC 885 ms
41,708 KB
testcase_04 AC 997 ms
45,992 KB
testcase_05 AC 167 ms
13,856 KB
testcase_06 AC 708 ms
35,648 KB
testcase_07 AC 80 ms
10,772 KB
testcase_08 AC 70 ms
10,404 KB
testcase_09 AC 350 ms
21,628 KB
testcase_10 AC 895 ms
41,140 KB
testcase_11 AC 985 ms
45,004 KB
testcase_12 AC 702 ms
35,120 KB
testcase_13 AC 220 ms
16,064 KB
testcase_14 AC 77 ms
10,668 KB
testcase_15 AC 859 ms
40,420 KB
testcase_16 AC 172 ms
14,160 KB
testcase_17 AC 981 ms
44,680 KB
testcase_18 AC 359 ms
21,496 KB
testcase_19 AC 330 ms
20,244 KB
testcase_20 AC 705 ms
35,112 KB
testcase_21 AC 922 ms
42,560 KB
testcase_22 AC 632 ms
31,960 KB
testcase_23 AC 461 ms
25,584 KB
testcase_24 AC 175 ms
14,492 KB
testcase_25 AC 443 ms
24,720 KB
testcase_26 AC 383 ms
22,396 KB
testcase_27 AC 907 ms
41,404 KB
testcase_28 AC 233 ms
16,660 KB
testcase_29 AC 249 ms
17,400 KB
testcase_30 AC 1,166 ms
49,516 KB
testcase_31 AC 283 ms
18,328 KB
testcase_32 AC 128 ms
12,344 KB
testcase_33 AC 721 ms
35,712 KB
testcase_34 AC 903 ms
42,604 KB
testcase_35 AC 312 ms
19,952 KB
testcase_36 AC 908 ms
41,724 KB
testcase_37 AC 346 ms
21,076 KB
testcase_38 AC 867 ms
39,560 KB
testcase_39 AC 240 ms
16,884 KB
testcase_40 AC 1,166 ms
51,012 KB
testcase_41 AC 1,148 ms
51,132 KB
testcase_42 AC 1,150 ms
51,220 KB
testcase_43 AC 1,160 ms
51,220 KB
testcase_44 AC 1,132 ms
51,132 KB
testcase_45 AC 1,156 ms
51,216 KB
testcase_46 AC 1,139 ms
51,052 KB
testcase_47 AC 1,121 ms
51,220 KB
testcase_48 AC 1,134 ms
51,080 KB
testcase_49 AC 1,135 ms
51,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

k=int(input())
num_list=[map(int,input().split()) for i in range(k)]
mod=10**9+7

for i in range(k):
    [n,m,x]=num_list[i]
    if(x==0):
        a=pow(1+m,n,mod)+pow(1-m,n,mod)
        if(a%2==1):
            a+=mod
        a=int(a/2)
    else:
        a=pow(1+m,n,mod)-pow(1-m,n,mod)
        if(a%2==1):
            a+=mod
        a=int(a/2)

    print(a%mod)
0