結果

問題 No.91 赤、緑、青の石
ユーザー simansiman
提出日時 2015-04-02 07:51:49
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 405 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 11,224 KB
実行使用メモリ 15,388 KB
最終ジャッジ日時 2023-09-17 00:55:29
合計ジャッジ時間 22,462 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,852 ms
15,172 KB
testcase_01 AC 1,259 ms
15,364 KB
testcase_02 AC 160 ms
15,176 KB
testcase_03 AC 801 ms
15,200 KB
testcase_04 AC 389 ms
15,272 KB
testcase_05 AC 762 ms
15,116 KB
testcase_06 WA -
testcase_07 AC 83 ms
15,092 KB
testcase_08 AC 79 ms
15,240 KB
testcase_09 AC 79 ms
15,056 KB
testcase_10 AC 79 ms
15,016 KB
testcase_11 AC 123 ms
15,208 KB
testcase_12 AC 1,071 ms
15,228 KB
testcase_13 AC 2,527 ms
15,160 KB
testcase_14 AC 619 ms
15,388 KB
testcase_15 AC 1,984 ms
15,224 KB
testcase_16 AC 79 ms
15,060 KB
testcase_17 AC 78 ms
15,104 KB
testcase_18 AC 80 ms
15,240 KB
testcase_19 AC 78 ms
15,084 KB
testcase_20 AC 79 ms
15,032 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 80 ms
15,272 KB
testcase_24 AC 82 ms
15,048 KB
testcase_25 AC 2,092 ms
15,172 KB
testcase_26 AC 1,760 ms
15,128 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 81 ms
15,268 KB
testcase_31 AC 1,459 ms
15,344 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

class Yukicoder
  def initialize
    r, g, b = gets.chomp.split(' ').map(&:to_i)

    list = [r,g,b].sort
    sum = 0

    loop do
      a, b, c = list

      count = [b - a, (2+c-b)/2].min

      list[0] += count
      list[2] -= 2 * count

      create = list.min

      break if create.zero?

      sum += create
      list = list.map{|i| i - create}.sort
    end

    puts sum
  end
end

Yukicoder.new
0