結果

問題 No.73 helloworld
ユーザー DialBird
提出日時 2017-02-21 09:28:28
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 899 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-12-30 12:16:00
合計ジャッジ時間 2,706 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

class Yukicoder
  def initialize
    alpha_num = 26
    @alphas = Array.new(alpha_num, 0)

    alpha_num.times do |i|
      @alphas[i] = gets.to_i
    end
  end

  def run
    if check()
      return calc()
    else
      return 0
    end
  end

  private
  
  def check
    necesarry_alpha_idx = [3, 4, 7, 11, 14, 17, 22]
    necesarry_alpha_num = [1, 1, 1, 3, 2, 1, 1]

    necesarry_alpha_idx.each_with_index do |i, idx|
      return false if @alphas[i] < necesarry_alpha_num[idx]
    end

    true
  end

  def calc
    l_count = @alphas[11]
    o_count = @alphas[14]

    l_max = 0
    2.upto(l_count - 1) do |i|
      atai = i * (i - 1) * (l_count - i) / 2
      l_max = atai > l_max ? atai : l_max
    end

    o_max = 0
    1.upto(o_count - 1) do |i|
      atai = i * (o_count - i)
      o_max = atai > o_max ? atai : o_max
    end

    return l_max * o_max
  end
end

puts Yukicoder.new.run
0