結果

問題 No.250 atetubouのzetubou
ユーザー simansiman
提出日時 2016-03-27 16:32:36
言語 Ruby
(3.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 606 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 29,696 KB
最終ジャッジ日時 2024-04-10 03:40:57
合計ジャッジ時間 12,903 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4,560 ms
24,448 KB
testcase_01 AC 1,771 ms
19,328 KB
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 AC 4,810 ms
28,160 KB
testcase_07 AC 3,595 ms
23,936 KB
testcase_08 TLE -
testcase_09 AC 4,798 ms
23,680 KB
testcase_10 TLE -
testcase_11 AC 4,329 ms
23,808 KB
testcase_12 TLE -
testcase_13 AC 4,197 ms
24,320 KB
testcase_14 AC 204 ms
17,152 KB
testcase_15 AC 1,021 ms
17,024 KB
testcase_16 AC 997 ms
17,664 KB
testcase_17 AC 972 ms
17,024 KB
testcase_18 AC 1,005 ms
17,152 KB
testcase_19 AC 1,007 ms
17,024 KB
testcase_20 AC 95 ms
12,416 KB
testcase_21 AC 99 ms
12,672 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

$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
0