結果

問題 No.391 CODING WAR
ユーザー dangodango
提出日時 2023-06-13 20:36:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 265 ms / 2,000 ms
コード長 299 bytes
コンパイル時間 1,037 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 77,060 KB
最終ジャッジ日時 2023-09-04 07:21:40
合計ジャッジ時間 4,630 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,188 KB
testcase_01 AC 74 ms
71,268 KB
testcase_02 AC 75 ms
71,388 KB
testcase_03 AC 75 ms
71,372 KB
testcase_04 AC 74 ms
71,348 KB
testcase_05 AC 73 ms
71,476 KB
testcase_06 AC 74 ms
71,392 KB
testcase_07 AC 75 ms
71,320 KB
testcase_08 AC 75 ms
71,428 KB
testcase_09 AC 265 ms
76,980 KB
testcase_10 AC 244 ms
76,892 KB
testcase_11 AC 77 ms
71,372 KB
testcase_12 AC 75 ms
71,372 KB
testcase_13 AC 255 ms
77,024 KB
testcase_14 AC 226 ms
77,060 KB
testcase_15 AC 245 ms
76,920 KB
testcase_16 AC 180 ms
76,900 KB
testcase_17 AC 197 ms
76,944 KB
testcase_18 AC 163 ms
76,916 KB
testcase_19 AC 164 ms
77,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
if N < M:
    print(0)
    exit(0)
r, c = 0, 1
for i in range(M):
    r += (-1) ** i * c * pow(M - i, N, (10 ** 9 + 7))
    r %= (10 ** 9 + 7)
    c *= M -  i
    c %= (10 ** 9 + 7)
    c *= pow(i + 1, (10 ** 9 + 7) - 2, (10 ** 9 + 7))
    c % (10 ** 9 + 7)
print(r)
0