結果
問題 | No.129 お年玉(2) |
ユーザー |
|
提出日時 | 2018-09-19 17:43:13 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 40 ms / 5,000 ms |
コード長 | 649 bytes |
コンパイル時間 | 396 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 12,160 KB |
最終ジャッジ日時 | 2024-11-28 01:10:58 |
合計ジャッジ時間 | 3,013 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
import math class No129: n = 0 m = 0 def __init__(self): self.n = int(input()) self.m = int(input()) def solve(self): yen = self.n // 1000 if yen < self.m: return ((math.factorial(self.m) // math.factorial(self.m - yen)) // math.factorial(yen)) % 1000000000 else: amari = yen % self.m if amari == 0: return 1 return ((math.factorial(self.m) // math.factorial(self.m - amari)) // math.factorial(amari)) % 1000000000 if __name__ == "__main__": que = No129() ans = que.solve() print(ans)