結果

問題 No.1035 Color Box
ユーザー 👑 KazunKazun
提出日時 2020-12-22 00:37:41
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 148 ms / 2,000 ms
コード長 318 bytes
コンパイル時間 1,562 ms
コンパイル使用メモリ 81,544 KB
実行使用メモリ 76,752 KB
最終ジャッジ日時 2023-10-21 12:15:57
合計ジャッジ時間 5,694 ms
ジャッジサーバーID
(参考情報)
judge12 / judge9
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
76,752 KB
testcase_01 AC 39 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 55 ms
63,988 KB
testcase_04 AC 57 ms
63,988 KB
testcase_05 AC 51 ms
61,940 KB
testcase_06 AC 39 ms
53,460 KB
testcase_07 AC 41 ms
53,460 KB
testcase_08 AC 135 ms
76,552 KB
testcase_09 AC 82 ms
70,692 KB
testcase_10 AC 37 ms
53,460 KB
testcase_11 AC 38 ms
53,460 KB
testcase_12 AC 37 ms
53,460 KB
testcase_13 AC 118 ms
76,244 KB
testcase_14 AC 128 ms
76,392 KB
testcase_15 AC 146 ms
76,740 KB
testcase_16 AC 38 ms
53,460 KB
testcase_17 AC 37 ms
53,460 KB
testcase_18 AC 38 ms
53,460 KB
testcase_19 AC 147 ms
76,748 KB
testcase_20 AC 39 ms
53,460 KB
testcase_21 AC 38 ms
53,460 KB
testcase_22 AC 39 ms
53,460 KB
testcase_23 AC 39 ms
53,460 KB
testcase_24 AC 38 ms
53,460 KB
testcase_25 AC 38 ms
53,460 KB
testcase_26 AC 38 ms
53,460 KB
testcase_27 AC 38 ms
53,460 KB
testcase_28 AC 38 ms
53,460 KB
testcase_29 AC 38 ms
53,460 KB
testcase_30 AC 37 ms
53,460 KB
testcase_31 AC 38 ms
53,460 KB
testcase_32 AC 38 ms
53,460 KB
testcase_33 AC 37 ms
53,460 KB
testcase_34 AC 38 ms
53,460 KB
testcase_35 AC 38 ms
53,460 KB
testcase_36 AC 37 ms
53,460 KB
testcase_37 AC 38 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

Inv=[0]*(M+1)
Inv[1]=1
for i in range(2,M+1):
    q,r=divmod(Mod,i)
    Inv[i]=(-q*Inv[r])%Mod

Comb=[0]*(M+1)
Comb[0]=1
for r in range(1,M+1):
    Comb[r]=((M+1-r)*Inv[r]*Comb[r-1])%Mod

X=0
for i in range(M+1):
    X+=pow(-1,M-i,Mod)*Comb[i]*pow(i,N,Mod)
    X%=Mod
print(X)
0