結果

問題 No.391 CODING WAR
ユーザー lloyzlloyz
提出日時 2023-02-26 16:03:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 264 ms / 2,000 ms
コード長 280 bytes
コンパイル時間 1,316 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 77,076 KB
最終ジャッジ日時 2023-10-12 07:18:59
合計ジャッジ時間 4,218 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,440 KB
testcase_01 AC 73 ms
71,380 KB
testcase_02 AC 75 ms
71,180 KB
testcase_03 AC 75 ms
70,912 KB
testcase_04 AC 73 ms
71,316 KB
testcase_05 AC 75 ms
71,508 KB
testcase_06 AC 76 ms
71,304 KB
testcase_07 AC 77 ms
71,488 KB
testcase_08 AC 75 ms
71,240 KB
testcase_09 AC 264 ms
76,956 KB
testcase_10 AC 243 ms
76,752 KB
testcase_11 AC 75 ms
71,504 KB
testcase_12 AC 76 ms
71,400 KB
testcase_13 AC 257 ms
76,636 KB
testcase_14 AC 226 ms
76,968 KB
testcase_15 AC 248 ms
76,952 KB
testcase_16 AC 181 ms
76,832 KB
testcase_17 AC 193 ms
76,428 KB
testcase_18 AC 157 ms
77,076 KB
testcase_19 AC 161 ms
76,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
mod = 10**9 + 7

if n < m:
    print(0)
    exit()

ans = 0
comb = 1
for i in range(m):
    ans += (-1)**i * comb * pow(m - i, n, mod)
    ans %= mod
    comb *= m - i
    comb %= mod
    comb *= pow(i + 1, mod - 2, mod)
    comb % mod
print(ans)
0