結果

問題 No.129 お年玉(2)
ユーザー mkawa2mkawa2
提出日時 2019-12-24 13:27:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 901 bytes
コンパイル時間 473 ms
コンパイル使用メモリ 11,772 KB
実行使用メモリ 775,928 KB
最終ジャッジ日時 2023-10-21 20:05:33
合計ジャッジ時間 10,645 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,287 ms
175,000 KB
testcase_01 MLE -
testcase_02 AC 29 ms
9,956 KB
testcase_03 AC 30 ms
9,956 KB
testcase_04 AC 30 ms
9,956 KB
testcase_05 MLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MF(): return map(float, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LF(): return list(map(float, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

md = 10 ** 9
memo = {}

def com(com_n, com_r):
    if com_n < com_r * 2: com_r = com_n - com_r
    if (com_n, com_r) in memo: return memo[(com_n, com_r)]
    if com_r == 1: return com_n
    if com_r == 0: return 1
    res = memo[(com_n, com_r)] = (com(com_n - 1, com_r) + com(com_n - 1, com_r - 1)) % md
    return res

def main():
    n = II()
    m = II()
    n //= 1000
    hit = n % m
    print(com(m, hit))

main()
0