結果

問題 No.250 atetubouのzetubou
コンテスト
ユーザー siman
提出日時 2016-03-27 16:31:16
言語 Ruby
(4.0.7 + ACL)
コンパイル:
ruby -w -c _filename_
実行:
ruby _filename_
結果
AC  
実行時間 2,955 ms / 5,000 ms
+ 667µs
コード長 558 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 11 ms
コンパイル使用メモリ 8,704 KB
実行使用メモリ 87,980 KB
最終ジャッジ日時 2026-10-13 19:32:39
合計ジャッジ時間 41,623 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #
raw source code

$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

    q.times do
      d, x, t = gets.chomp.split.map(&:to_i)

      if (x+d-1).combination(d-1) <= t
        puts "AC"
      else
        puts "ZETUBOU"
      end
    end
  end
end

Yukicoder.new
0