結果

問題 No.571 3人兄弟(その2)
ユーザー nCk_cvnCk_cv
提出日時 2017-12-31 18:01:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 869 bytes
コンパイル時間 2,060 ms
コンパイル使用メモリ 76,028 KB
実行使用メモリ 56,244 KB
最終ジャッジ日時 2023-08-23 12:32:47
合計ジャッジ時間 4,631 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,204 KB
testcase_01 AC 121 ms
55,836 KB
testcase_02 AC 127 ms
55,252 KB
testcase_03 AC 120 ms
55,656 KB
testcase_04 AC 120 ms
56,244 KB
testcase_05 AC 121 ms
55,824 KB
testcase_06 AC 127 ms
55,640 KB
testcase_07 AC 127 ms
55,496 KB
testcase_08 AC 123 ms
55,824 KB
testcase_09 AC 122 ms
55,648 KB
testcase_10 AC 123 ms
55,424 KB
testcase_11 AC 133 ms
55,820 KB
testcase_12 AC 125 ms
55,908 KB
testcase_13 AC 123 ms
55,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.awt.image.IndexColorModel;
import java.util.*;
import java.util.stream.Collector;
import java.util.stream.*;

public class Main {

    public static class Data implements Comparable<Data> {
        char ID;
        int he;
        int we;
        Data(char a, int b, int c) {
            ID = a;
            he = b;
            we = c;
        }

        public int compareTo(Data o) {
            if(o.he == this.he) return -o.we + this.we;
            return -this.he + o.he;
        }
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Data[] d = new Data[3];
        for(int i = 0; i < 3; i++) {
            d[i] = new Data((char)('A' + i),sc.nextInt(),sc.nextInt());
        }
        Arrays.sort(d);
        for(int i = 0; i < 3; i++) {
            System.out.println(d[i].ID);
        }


    }
}
0