結果

問題 No.1035 Color Box
ユーザー KodaiKodai
提出日時 2020-04-30 20:23:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 159 ms / 2,000 ms
コード長 393 bytes
コンパイル時間 514 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 79,444 KB
最終ジャッジ日時 2023-08-22 15:43:15
合計ジャッジ時間 6,242 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 159 ms
79,444 KB
testcase_01 AC 70 ms
71,080 KB
testcase_02 AC 70 ms
71,028 KB
testcase_03 AC 87 ms
76,460 KB
testcase_04 AC 90 ms
76,468 KB
testcase_05 AC 84 ms
76,456 KB
testcase_06 AC 74 ms
74,916 KB
testcase_07 AC 76 ms
74,900 KB
testcase_08 AC 150 ms
79,040 KB
testcase_09 AC 111 ms
76,936 KB
testcase_10 AC 70 ms
71,136 KB
testcase_11 AC 69 ms
71,168 KB
testcase_12 AC 69 ms
71,196 KB
testcase_13 AC 137 ms
78,208 KB
testcase_14 AC 147 ms
78,592 KB
testcase_15 AC 159 ms
79,312 KB
testcase_16 AC 70 ms
71,044 KB
testcase_17 AC 70 ms
71,224 KB
testcase_18 AC 70 ms
71,116 KB
testcase_19 AC 158 ms
79,356 KB
testcase_20 AC 69 ms
71,280 KB
testcase_21 AC 71 ms
70,916 KB
testcase_22 AC 70 ms
71,120 KB
testcase_23 AC 70 ms
70,868 KB
testcase_24 AC 70 ms
71,104 KB
testcase_25 AC 70 ms
71,032 KB
testcase_26 AC 69 ms
70,912 KB
testcase_27 AC 69 ms
70,916 KB
testcase_28 AC 71 ms
71,156 KB
testcase_29 AC 69 ms
71,120 KB
testcase_30 AC 68 ms
71,104 KB
testcase_31 AC 69 ms
70,996 KB
testcase_32 AC 68 ms
71,000 KB
testcase_33 AC 69 ms
71,000 KB
testcase_34 AC 68 ms
71,072 KB
testcase_35 AC 71 ms
70,856 KB
testcase_36 AC 70 ms
71,084 KB
testcase_37 AC 70 ms
71,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10**9 + 7
N, M = list(map(int, input().split()))


def modinv(a):
    return pow(a, MOD - 2, MOD)


temp_list = [1]
for i in range(0, (M // 2)):
    temp_list.append(int(((temp_list[-1] * ((M - i)) % MOD) * (modinv((i + 1))) % MOD)) % MOD)


before = 0
for i in range(1, M + 1):
    before = ((((temp_list[min([i, (M - i)])]) * pow(i, N, MOD)) % MOD) - before) % MOD

print(before % MOD)
0