結果

問題 No.129 お年玉(2)
ユーザー Mao-betaMao-beta
提出日時 2024-03-14 18:27:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,070 ms / 5,000 ms
コード長 928 bytes
コンパイル時間 343 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 493,020 KB
最終ジャッジ日時 2024-03-14 18:28:22
合計ジャッジ時間 46,023 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
94,812 KB
testcase_01 AC 2,070 ms
493,020 KB
testcase_02 AC 46 ms
55,624 KB
testcase_03 AC 45 ms
55,624 KB
testcase_04 AC 46 ms
55,624 KB
testcase_05 AC 786 ms
246,364 KB
testcase_06 AC 1,255 ms
345,180 KB
testcase_07 AC 1,536 ms
408,540 KB
testcase_08 AC 1,058 ms
299,612 KB
testcase_09 AC 1,418 ms
379,484 KB
testcase_10 AC 1,589 ms
419,164 KB
testcase_11 AC 1,020 ms
291,676 KB
testcase_12 AC 1,320 ms
358,364 KB
testcase_13 AC 1,382 ms
371,548 KB
testcase_14 AC 1,324 ms
361,052 KB
testcase_15 AC 1,102 ms
310,364 KB
testcase_16 AC 1,250 ms
342,492 KB
testcase_17 AC 1,501 ms
400,604 KB
testcase_18 AC 1,420 ms
382,044 KB
testcase_19 AC 1,519 ms
403,164 KB
testcase_20 AC 1,500 ms
400,604 KB
testcase_21 AC 1,880 ms
482,524 KB
testcase_22 AC 1,070 ms
302,300 KB
testcase_23 AC 1,645 ms
432,348 KB
testcase_24 AC 1,588 ms
416,476 KB
testcase_25 AC 1,006 ms
291,676 KB
testcase_26 AC 1,052 ms
296,924 KB
testcase_27 AC 1,017 ms
291,676 KB
testcase_28 AC 1,913 ms
487,772 KB
testcase_29 AC 45 ms
55,624 KB
testcase_30 AC 45 ms
55,624 KB
testcase_31 AC 49 ms
61,540 KB
testcase_32 AC 49 ms
61,540 KB
testcase_33 AC 67 ms
77,512 KB
testcase_34 AC 54 ms
68,168 KB
testcase_35 AC 65 ms
77,512 KB
testcase_36 AC 68 ms
77,512 KB
testcase_37 AC 70 ms
77,512 KB
testcase_38 AC 240 ms
119,644 KB
testcase_39 AC 354 ms
144,220 KB
testcase_40 AC 924 ms
275,804 KB
testcase_41 AC 601 ms
195,420 KB
testcase_42 AC 270 ms
125,148 KB
testcase_43 AC 265 ms
125,148 KB
testcase_44 AC 1,937 ms
490,332 KB
testcase_45 AC 167 ms
100,444 KB
testcase_46 AC 383 ms
152,284 KB
testcase_47 AC 1,862 ms
474,588 KB
testcase_48 AC 1,114 ms
313,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
import bisect
from heapq import heapify, heappop, heappush
from collections import deque, defaultdict, Counter
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD99 = 998244353

input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()
SMI = lambda: input().split()
SLI = lambda: list(SMI())
EI = lambda m: [NLI() for _ in range(m)]


def main():
    N = NI()
    M = NI()
    R = N // 1000 % M
    C = [[] for _ in range(M+1)]
    mod = 10**9
    C[0].append(1)
    C[1] = [1, 1]
    for n in range(2, M+1):
        C[n].append(1)
        for r in range(1, n):
            C[n].append((C[n-1][r] + C[n-1][r-1]) % mod)
        C[n].append(1)
    print(C[M][R])


if __name__ == "__main__":
    main()
0