結果

問題 No.391 CODING WAR
ユーザー TawaraTawara
提出日時 2015-12-30 15:02:40
言語 Python2
(2.7.18)
結果
AC  
実行時間 253 ms / 2,000 ms
コード長 228 bytes
コンパイル時間 570 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 15,656 KB
最終ジャッジ日時 2024-04-21 00:57:25
合計ジャッジ時間 2,638 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
6,016 KB
testcase_01 AC 11 ms
6,272 KB
testcase_02 AC 10 ms
6,144 KB
testcase_03 AC 10 ms
6,272 KB
testcase_04 AC 9 ms
6,016 KB
testcase_05 AC 10 ms
6,144 KB
testcase_06 AC 9 ms
6,272 KB
testcase_07 AC 10 ms
6,144 KB
testcase_08 AC 9 ms
6,144 KB
testcase_09 AC 253 ms
15,532 KB
testcase_10 AC 246 ms
15,656 KB
testcase_11 AC 177 ms
15,656 KB
testcase_12 AC 10 ms
6,144 KB
testcase_13 AC 234 ms
15,516 KB
testcase_14 AC 182 ms
13,480 KB
testcase_15 AC 207 ms
14,468 KB
testcase_16 AC 127 ms
10,880 KB
testcase_17 AC 152 ms
11,912 KB
testcase_18 AC 105 ms
10,060 KB
testcase_19 AC 105 ms
10,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p=10**9+7;R=range;N,M=map(int,raw_input().split());F=[1]
for i in R(1,M+1):F+=[i*F[i-1]%p]
I=[0]*(M+1);I[M]=pow(F[M],p-2,p)
for i in R(M,0,-1):I[i-1]=i*I[i]%p
print sum(F[M]*I[k]*I[M-k]*pow(M-k,N,p)*((-1)**(k%2))for k in R(M))%p
0