結果

問題 No.1258 コインゲーム
ユーザー jensenjensen
提出日時 2021-01-09 13:45:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,540 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 54,016 KB
最終ジャッジ日時 2024-04-28 21:10:53
合計ジャッジ時間 45,402 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 283 ms
18,560 KB
testcase_01 AC 358 ms
20,864 KB
testcase_02 AC 147 ms
14,208 KB
testcase_03 AC 1,176 ms
44,288 KB
testcase_04 AC 1,293 ms
48,512 KB
testcase_05 AC 222 ms
16,768 KB
testcase_06 AC 927 ms
38,272 KB
testcase_07 AC 114 ms
13,184 KB
testcase_08 AC 100 ms
12,800 KB
testcase_09 AC 465 ms
24,192 KB
testcase_10 AC 1,144 ms
43,648 KB
testcase_11 AC 1,272 ms
47,744 KB
testcase_12 AC 910 ms
37,632 KB
testcase_13 AC 287 ms
18,688 KB
testcase_14 AC 110 ms
13,184 KB
testcase_15 AC 1,101 ms
43,008 KB
testcase_16 AC 230 ms
16,896 KB
testcase_17 AC 1,247 ms
47,232 KB
testcase_18 AC 460 ms
24,064 KB
testcase_19 AC 426 ms
23,040 KB
testcase_20 AC 923 ms
37,504 KB
testcase_21 AC 1,183 ms
45,056 KB
testcase_22 AC 812 ms
34,560 KB
testcase_23 AC 592 ms
28,288 KB
testcase_24 AC 233 ms
17,024 KB
testcase_25 AC 563 ms
27,520 KB
testcase_26 AC 492 ms
24,832 KB
testcase_27 AC 1,145 ms
44,032 KB
testcase_28 AC 298 ms
19,072 KB
testcase_29 AC 323 ms
19,840 KB
testcase_30 AC 1,448 ms
52,224 KB
testcase_31 AC 361 ms
20,864 KB
testcase_32 AC 172 ms
15,104 KB
testcase_33 AC 931 ms
38,144 KB
testcase_34 AC 1,190 ms
45,184 KB
testcase_35 AC 415 ms
22,656 KB
testcase_36 AC 1,164 ms
44,416 KB
testcase_37 AC 449 ms
23,680 KB
testcase_38 AC 1,082 ms
42,240 KB
testcase_39 AC 310 ms
19,328 KB
testcase_40 AC 1,453 ms
53,760 KB
testcase_41 AC 1,470 ms
53,760 KB
testcase_42 AC 1,439 ms
53,760 KB
testcase_43 AC 1,463 ms
53,632 KB
testcase_44 AC 1,468 ms
53,888 KB
testcase_45 AC 1,450 ms
53,888 KB
testcase_46 AC 1,469 ms
54,016 KB
testcase_47 AC 1,540 ms
53,760 KB
testcase_48 AC 1,451 ms
53,888 KB
testcase_49 AC 1,462 ms
53,888 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