結果
| 問題 | No.129 お年玉(2) |
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2016-03-23 00:59:09 |
| 言語 | Ruby (4.0.2) |
| 結果 |
AC
|
| 実行時間 | 129 ms / 5,000 ms |
| コード長 | 409 bytes |
| 記録 | |
| コンパイル時間 | 402 ms |
| コンパイル使用メモリ | 8,960 KB |
| 実行使用メモリ | 57,728 KB |
| 最終ジャッジ日時 | 2026-05-22 04:45:52 |
| 合計ジャッジ時間 | 6,169 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 |
コンパイルメッセージ
Syntax OK
ソースコード
class Integer
def combination(k)
self.factorial/(k.factorial*(self-k).factorial)
end
def permutation(k)
self.factorial/(self-k).factorial
end
def factorial
return 1 if self == 0
(1..self).inject(:*)
end
end
class Yukicoder
MOD = 1000000000
def initialize
n = gets.to_i
m = gets.to_i
puts m.combination((n-m*1000*(n/m/1000))/1000) % MOD
end
end
Yukicoder.new
siman