結果

問題 No.91 赤、緑、青の石
ユーザー maimai
提出日時 2016-01-31 13:23:46
言語 Ruby
(3.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 497 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-04-16 10:33:53
合計ジャッジ時間 4,112 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
12,288 KB
testcase_01 AC 87 ms
12,160 KB
testcase_02 AC 90 ms
12,160 KB
testcase_03 AC 89 ms
12,160 KB
testcase_04 AC 89 ms
12,288 KB
testcase_05 AC 88 ms
12,160 KB
testcase_06 AC 88 ms
12,160 KB
testcase_07 AC 88 ms
12,288 KB
testcase_08 AC 87 ms
12,288 KB
testcase_09 AC 89 ms
12,288 KB
testcase_10 AC 88 ms
12,160 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 89 ms
12,160 KB
testcase_14 AC 88 ms
12,160 KB
testcase_15 AC 88 ms
12,288 KB
testcase_16 AC 91 ms
12,288 KB
testcase_17 AC 92 ms
12,160 KB
testcase_18 AC 89 ms
12,160 KB
testcase_19 AC 89 ms
12,160 KB
testcase_20 AC 89 ms
12,160 KB
testcase_21 AC 90 ms
12,160 KB
testcase_22 AC 88 ms
12,288 KB
testcase_23 AC 88 ms
12,288 KB
testcase_24 AC 89 ms
12,160 KB
testcase_25 AC 88 ms
12,288 KB
testcase_26 AC 88 ms
12,288 KB
testcase_27 AC 90 ms
12,160 KB
testcase_28 AC 88 ms
12,160 KB
testcase_29 AC 87 ms
12,160 KB
testcase_30 AC 88 ms
12,160 KB
testcase_31 AC 89 ms
12,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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!
}
g+=1 if r[2]==3 && r[1]>0
p g
0