結果
| 問題 |
No.250 atetubouのzetubou
|
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2016-03-27 16:32:36 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 4,966 ms / 5,000 ms |
| コード長 | 606 bytes |
| コンパイル時間 | 112 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 30,080 KB |
| 最終ジャッジ日時 | 2024-10-02 05:05:55 |
| 合計ジャッジ時間 | 19,324 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
コンパイルメッセージ
Syntax OK
ソースコード
$cache = Hash.new
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
return $cache[self] if $cache[self]
$cache[self] = (1..self).inject(:*)
end
end
class Yukicoder
def initialize
q = gets.to_i
answers = []
q.times do
d, x, t = gets.chomp.split.map(&:to_i)
if (x+d-1).combination(d-1) <= t
answers << "AC"
else
answers << "ZETUBOU"
end
end
puts answers
end
end
Yukicoder.new
siman