結果

問題 No.129 お年玉(2)
ユーザー daleksprinter
提出日時 2018-08-27 00:43:26
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 341 bytes
コンパイル時間 46 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-01 04:04:50
合計ジャッジ時間 2,098 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 WA * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
mod = 10**9+7
def inv(x):
	return pow(x,mod-2,mod)

def factorial(x):
	retval = 1
	for i in range(2,x+1):
		retval = (retval * i)% mod
	return retval

def nCr(n,r):
	return factorial(n) * inv(factorial(n-r)) * inv(factorial(r)) % mod

n = int(input())

m = int(input())

rest = (n%(1000*m))
print nCr(m,(rest - (rest%1000))/1000)
0