結果
問題 | No.129 お年玉(2) |
ユーザー |
![]() |
提出日時 | 2019-12-24 13:15:32 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 994 bytes |
コンパイル時間 | 208 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 11,648 KB |
最終ジャッジ日時 | 2024-09-21 21:13:54 |
合計ジャッジ時間 | 3,237 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 WA * 41 |
ソースコード
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)] def com(com_n, com_r): return fac[com_n] * inv[com_r] * inv[com_n - com_r] % md # combinationの準備 # md>n_maxの条件 md = 10**9+7 n_max = 10**4+5 fac = [1] inv = [1] * (n_max + 1) k_fac_inv = 1 for i in range(1, n_max + 1): k_fac_inv = k_fac_inv * i % md fac.append(k_fac_inv) k_fac_inv = pow(k_fac_inv, md - 2, md) for i in range(n_max, 1, -1): inv[i] = k_fac_inv k_fac_inv = k_fac_inv * i % md def main(): n=II() m=II() n//=1000 hit=n%m print(com(m,hit)) main()