結果

問題 No.391 CODING WAR
ユーザー cielciel
提出日時 2016-07-09 12:56:12
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 227 ms / 2,000 ms
コード長 261 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 77,112 KB
実行使用メモリ 82,176 KB
最終ジャッジ日時 2024-04-21 10:40:42
合計ジャッジ時間 3,752 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
75,532 KB
testcase_01 AC 83 ms
75,648 KB
testcase_02 AC 81 ms
75,520 KB
testcase_03 AC 83 ms
75,648 KB
testcase_04 AC 86 ms
75,392 KB
testcase_05 AC 81 ms
75,904 KB
testcase_06 AC 81 ms
75,648 KB
testcase_07 AC 83 ms
75,264 KB
testcase_08 AC 82 ms
75,776 KB
testcase_09 AC 227 ms
81,720 KB
testcase_10 AC 180 ms
81,664 KB
testcase_11 AC 164 ms
81,780 KB
testcase_12 AC 85 ms
75,536 KB
testcase_13 AC 188 ms
82,176 KB
testcase_14 AC 177 ms
81,152 KB
testcase_15 AC 193 ms
81,408 KB
testcase_16 AC 178 ms
79,872 KB
testcase_17 AC 161 ms
80,760 KB
testcase_18 AC 141 ms
79,488 KB
testcase_19 AC 141 ms
79,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
n,m=map(int,sys.stdin.readline().split())
M=10**9+7
I=[1]*(m+1);F=[1]*(m+1);R=[1]*(m+1)
for i in range(2,m+1):
	I[i]=(M-M//i)*I[M%i]%M
	F[i]=i*F[i-1]%M
	R[i]=I[i]*R[i-1]%M
r=0
for k in range(m):
	r=(r+(-1)**k*F[m]*R[k]*R[m-k]*pow(m-k,n,M))%M
print(r)
0