結果

問題 No.91 赤、緑、青の石
ユーザー maimai
提出日時 2016-10-13 17:27:27
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 305 bytes
コンパイル時間 50 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-05-01 21:46:58
合計ジャッジ時間 3,787 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 79 ms
12,288 KB
testcase_08 AC 82 ms
12,032 KB
testcase_09 AC 80 ms
12,160 KB
testcase_10 AC 85 ms
12,288 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 80 ms
12,160 KB
testcase_17 AC 82 ms
12,416 KB
testcase_18 AC 83 ms
12,160 KB
testcase_19 AC 81 ms
12,416 KB
testcase_20 AC 80 ms
12,288 KB
testcase_21 AC 81 ms
12,288 KB
testcase_22 WA -
testcase_23 AC 82 ms
12,288 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 79 ms
12,032 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 81 ms
12,288 KB
testcase_31 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def calc(stone)
    if (stone[0]!=0)
        return stone[0] + calc(stone.map{|e| e-stone[0]})
    elsif (stone[1]==0 || stone[2]<=2)
        return 0
    else
        k = stone[2] / 3
        return calc([k,stone[1],stone[2]-k*2].sort!)
    end
end

r,g,b = gets.split.map(&:to_i)

p calc([r,g,b].sort)
0