結果

問題 No.823 Many Shifts Easy
ユーザー pluto77pluto77
提出日時 2019-05-23 17:06:22
言語 Python2
(2.7.18)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 223 bytes
コンパイル時間 58 ms
コンパイル使用メモリ 7,064 KB
実行使用メモリ 6,412 KB
最終ジャッジ日時 2023-10-17 11:30:35
合計ジャッジ時間 1,371 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
6,412 KB
testcase_01 AC 11 ms
6,412 KB
testcase_02 AC 10 ms
6,412 KB
testcase_03 AC 61 ms
6,412 KB
testcase_04 AC 11 ms
6,412 KB
testcase_05 AC 43 ms
6,412 KB
testcase_06 AC 45 ms
6,412 KB
testcase_07 AC 10 ms
6,412 KB
testcase_08 AC 16 ms
6,412 KB
testcase_09 AC 11 ms
6,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki823

mod=10**9+7
def f(x):
 return x*(x+1)/2%mod

n,k=map(int,raw_input().split())
a=f(n)
b=f(n-1)*f(k-1)%mod
for i in xrange(k):
 a*=(n-i-1)%mod
 a=a%mod
for i in xrange(k-2):
 b*=(n-i-2)%mod
 b=b%mod
print (a+b)%mod
0