結果

問題 No.1035 Color Box
ユーザー tanon710tanon710
提出日時 2020-05-04 16:18:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 207 ms / 2,000 ms
コード長 305 bytes
コンパイル時間 228 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 90,880 KB
最終ジャッジ日時 2023-09-06 18:07:12
合計ジャッジ時間 6,062 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 194 ms
90,740 KB
testcase_01 AC 71 ms
76,252 KB
testcase_02 AC 62 ms
71,232 KB
testcase_03 AC 76 ms
76,396 KB
testcase_04 AC 127 ms
85,952 KB
testcase_05 AC 82 ms
76,640 KB
testcase_06 AC 64 ms
71,244 KB
testcase_07 AC 146 ms
88,624 KB
testcase_08 AC 191 ms
90,380 KB
testcase_09 AC 164 ms
89,764 KB
testcase_10 AC 89 ms
79,048 KB
testcase_11 AC 69 ms
76,164 KB
testcase_12 AC 72 ms
76,252 KB
testcase_13 AC 188 ms
90,116 KB
testcase_14 AC 207 ms
90,208 KB
testcase_15 AC 198 ms
90,680 KB
testcase_16 AC 60 ms
71,208 KB
testcase_17 AC 63 ms
71,080 KB
testcase_18 AC 58 ms
71,240 KB
testcase_19 AC 200 ms
90,880 KB
testcase_20 AC 63 ms
71,352 KB
testcase_21 AC 59 ms
71,276 KB
testcase_22 AC 62 ms
71,188 KB
testcase_23 AC 59 ms
71,328 KB
testcase_24 AC 58 ms
71,492 KB
testcase_25 AC 60 ms
71,356 KB
testcase_26 AC 59 ms
71,240 KB
testcase_27 AC 61 ms
71,368 KB
testcase_28 AC 61 ms
71,264 KB
testcase_29 AC 60 ms
71,436 KB
testcase_30 AC 59 ms
71,316 KB
testcase_31 AC 59 ms
71,456 KB
testcase_32 AC 60 ms
71,576 KB
testcase_33 AC 59 ms
71,080 KB
testcase_34 AC 58 ms
71,492 KB
testcase_35 AC 60 ms
71,492 KB
testcase_36 AC 59 ms
71,408 KB
testcase_37 AC 59 ms
71,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=10**9+7
n,m=map(int,input().split())
fact=[1]
for i in range(1,n+1):
    fact.append((fact[-1]*i)%mod)
revfact=[1]
for i in range(1,n+1):
    revfact.append(pow(fact[i],mod-2,mod))
ans=0
for i in range(0,m+1):
    ans+=pow(-1,i)*(fact[m]*revfact[i]*revfact[m-i])*pow(m-i,n,mod)
    ans%=mod
print(ans)
0