結果

問題 No.571 3人兄弟(その2)
ユーザー gemmarogemmaro
提出日時 2019-11-10 08:09:53
言語 Ruby
(3.2.2)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 393 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 11,540 KB
実行使用メモリ 15,264 KB
最終ジャッジ日時 2023-10-13 07:39:04
合計ジャッジ時間 2,329 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,080 KB
testcase_01 AC 81 ms
15,080 KB
testcase_02 AC 78 ms
15,136 KB
testcase_03 AC 80 ms
15,132 KB
testcase_04 AC 79 ms
15,180 KB
testcase_05 AC 79 ms
15,112 KB
testcase_06 AC 81 ms
15,108 KB
testcase_07 AC 82 ms
15,156 KB
testcase_08 AC 80 ms
15,256 KB
testcase_09 AC 80 ms
15,036 KB
testcase_10 AC 81 ms
15,072 KB
testcase_11 AC 80 ms
15,264 KB
testcase_12 AC 81 ms
15,204 KB
testcase_13 AC 81 ms
15,148 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

ha, wa = gets.chomp.split.map &:to_i
hb, wb = gets.chomp.split.map &:to_i
hc, wc = gets.chomp.split.map &:to_i

a = {"h"=>ha, "w"=>wa, "name"=>"A"}
b = {"h"=>hb, "w"=>wb, "name"=>"B"}
c = {"h"=>hc, "w"=>wc, "name"=>"C"}
brothers = [a, b, c]

puts brothers.sort{|x, y|
    if x["h"] == y["h"]
        x["w"] <=> y["w"]
    else
        y["h"] <=> x["h"]
    end
}.map{|z| z["name"] }.join("\n")
0