結果

問題 No.73 helloworld
ユーザー DialBirdDialBird
提出日時 2017-02-21 09:28:28
言語 Ruby
(3.2.2)
結果
WA  
実行時間 -
コード長 899 bytes
コンパイル時間 550 ms
コンパイル使用メモリ 11,228 KB
実行使用メモリ 15,404 KB
最終ジャッジ日時 2023-08-28 22:14:55
合計ジャッジ時間 2,545 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 83 ms
15,280 KB
testcase_02 AC 80 ms
15,284 KB
testcase_03 AC 81 ms
15,264 KB
testcase_04 AC 81 ms
15,180 KB
testcase_05 WA -
testcase_06 AC 80 ms
15,252 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 81 ms
15,044 KB
testcase_13 AC 81 ms
15,116 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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