結果
| 問題 |
No.129 お年玉(2)
|
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2016-03-23 00:54:37 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 383 bytes |
| コンパイル時間 | 159 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 53,760 KB |
| 最終ジャッジ日時 | 2024-10-01 15:21:55 |
| 合計ジャッジ時間 | 7,385 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 WA * 41 |
コンパイルメッセージ
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
def initialize
n = gets.to_i
m = gets.to_i
puts m.combination((n-m*1000*(n/m/1000))/1000)
end
end
Yukicoder.new
siman