結果

問題 No.129 お年玉(2)
コンテスト
ユーザー yuki2006
提出日時 2015-01-14 22:35:23
言語 PyPy2
(7.3.20)
コンパイル:
pypy2 -m py_compile _filename_
実行:
/usr/bin/pypy2 Main.pyc
結果
AC  
実行時間 88 ms / 5,000 ms
コード長 320 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,761 ms
コンパイル使用メモリ 80,896 KB
実行使用メモリ 82,432 KB
最終ジャッジ日時 2026-05-22 03:37:28
合計ジャッジ時間 7,060 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 46
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(raw_input())
M = int(raw_input())

assert 1 <= N <= 10 ** 16
assert 1 <= M <= 10 ** 4
#多倍長解

def C(N, K):
    result = 1
    for i in xrange(1, K + 1):
        result *= (N - i + 1)
        result /= i
    return result


A = (N // 1000) / M
K = (N // 1000) - A * M

ans = C(M, K)%1000000000

print ans

0