結果

問題 No.250 atetubouのzetubou
ユーザー simansiman
提出日時 2016-03-27 16:31:16
言語 Ruby
(3.3.0)
結果
AC  
実行時間 4,036 ms / 5,000 ms
コード長 558 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 22,272 KB
最終ジャッジ日時 2024-04-10 03:27:00
合計ジャッジ時間 56,767 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3,409 ms
21,760 KB
testcase_01 AC 1,385 ms
19,328 KB
testcase_02 AC 3,756 ms
21,760 KB
testcase_03 AC 4,036 ms
22,144 KB
testcase_04 AC 3,787 ms
22,016 KB
testcase_05 AC 3,876 ms
22,272 KB
testcase_06 AC 3,541 ms
22,016 KB
testcase_07 AC 2,696 ms
21,248 KB
testcase_08 AC 3,881 ms
22,144 KB
testcase_09 AC 3,487 ms
22,016 KB
testcase_10 AC 3,842 ms
22,144 KB
testcase_11 AC 3,191 ms
21,376 KB
testcase_12 AC 3,716 ms
21,888 KB
testcase_13 AC 2,996 ms
21,248 KB
testcase_14 AC 164 ms
16,896 KB
testcase_15 AC 842 ms
15,488 KB
testcase_16 AC 824 ms
15,616 KB
testcase_17 AC 817 ms
15,744 KB
testcase_18 AC 826 ms
15,360 KB
testcase_19 AC 827 ms
15,616 KB
testcase_20 AC 83 ms
12,032 KB
testcase_21 AC 87 ms
12,544 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

    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