結果

問題 No.1035 Color Box
ユーザー c-yanc-yan
提出日時 2020-04-26 18:01:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 481 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 14,592 KB
最終ジャッジ日時 2024-04-28 20:18:38
合計ジャッジ時間 6,190 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,123 ms
14,592 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 AC 113 ms
10,880 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 1,132 ms
14,464 KB
testcase_20 AC 30 ms
10,624 KB
testcase_21 RE -
testcase_22 AC 30 ms
10,752 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 AC 30 ms
10,624 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 AC 30 ms
10,624 KB
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())

fac = [0] * (M + 1)
fac[0] = 1
for i in range(N):
    fac[i + 1] = fac[i] * (i + 1) % 1000000007


def mcomb(n, k):
    if n == 0 and k == 0:
        return 1
    if n < k or k < 0:
        return 0
    return fac[n] * pow(fac[n - k], 1000000005, 1000000007) * pow(fac[k], 1000000005, 1000000007) % 1000000007


result = 0
for i in range(1, M + 1):
    result = mcomb(M, i) * pow(i, N, 1000000007) - result
    result %= 1000000007

print(result)
0