結果

問題 No.91 赤、緑、青の石
ユーザー maimai
提出日時 2016-01-31 13:21:28
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 472 bytes
コンパイル時間 41 ms
コンパイル使用メモリ 11,900 KB
実行使用メモリ 16,080 KB
最終ジャッジ日時 2023-10-21 18:18:43
合計ジャッジ時間 3,801 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

r=gets.split(" ").map!(&:to_i)
g=r.min
r.map!{|e|e-g}.sort!;

loop{
    #p [g,r]
    if r[1]==0
        break if r[2]/5<=0
        g+=r[2]/5
        r[2]=r[2]-r[2]/5*5
    elsif r[1]*3<r[2]
        t=r[1]
        g+=t
        r[2]-=t*3
        r[1]-=t
    elsif r[2]-r[1]>1
        t=(r[2]-r[1])/2
        r[2]-=t*3
        r[1]-=t
        g+=t
    else
        break if r[1]<4
        t=r[1]/4
        r[1]-=t*4
        r[2]-=t*4
        g+=t*2
    end
    r.sort!
}

p g
0