結果

問題 No.570 3人兄弟(その1)
ユーザー tentententen
提出日時 2020-09-07 20:37:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 150 ms / 2,000 ms
コード長 789 bytes
コンパイル時間 2,426 ms
コンパイル使用メモリ 73,088 KB
実行使用メモリ 55,996 KB
最終ジャッジ日時 2023-08-19 17:08:51
合計ジャッジ時間 4,207 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
55,672 KB
testcase_01 AC 150 ms
55,516 KB
testcase_02 AC 143 ms
55,852 KB
testcase_03 AC 148 ms
55,864 KB
testcase_04 AC 143 ms
55,996 KB
testcase_05 AC 142 ms
55,548 KB
testcase_06 AC 146 ms
55,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
    	Person[] arr = new Person[3];
    	for (int i = 0; i < 3; i++) {
    	    arr[i] = new Person((char)(i + 'A'), sc.nextInt());
    	}
    	Arrays.sort(arr);
    	StringBuilder sb = new StringBuilder();
    	for (Person p : arr) {
    	    sb.append(p.name).append("\n");
    	}
    	System.out.print(sb);
    }
    
    static class Person implements Comparable<Person> {
        char name;
        int height;
        
        public Person(char name, int height) {
            this.name = name;
            this.height = height;
        }
        
        public int compareTo(Person another) {
            return another.height - height;
        }
    }

}
0