結果
問題 | No.571 3人兄弟(その2) |
ユーザー | htensai |
提出日時 | 2019-12-07 16:45:48 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 124 ms / 2,000 ms |
コード長 | 951 bytes |
コンパイル時間 | 2,328 ms |
コンパイル使用メモリ | 73,116 KB |
実行使用メモリ | 56,308 KB |
最終ジャッジ日時 | 2023-08-26 21:06:14 |
合計ジャッジ時間 | 4,929 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 119 ms
56,112 KB |
testcase_01 | AC | 119 ms
55,896 KB |
testcase_02 | AC | 117 ms
55,772 KB |
testcase_03 | AC | 124 ms
55,724 KB |
testcase_04 | AC | 119 ms
55,972 KB |
testcase_05 | AC | 120 ms
55,732 KB |
testcase_06 | AC | 123 ms
56,308 KB |
testcase_07 | AC | 121 ms
55,768 KB |
testcase_08 | AC | 121 ms
56,016 KB |
testcase_09 | AC | 120 ms
56,076 KB |
testcase_10 | AC | 119 ms
55,904 KB |
testcase_11 | AC | 119 ms
55,924 KB |
testcase_12 | AC | 121 ms
55,492 KB |
testcase_13 | AC | 117 ms
55,796 KB |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Person[] persons = new Person[3]; for (int i = 0; i < 3; i++) { persons[i] = new Person((char)(i + 'A'), sc.nextInt(), sc.nextInt()); } Arrays.sort(persons); for (int i = 0; i < 3; i++) { System.out.println(persons[i].id); } } static class Person implements Comparable<Person> { char id; int height; int weight; public Person (char id, int height, int weight) { this.id = id; this.height = height; this.weight = weight; } public int compareTo(Person another) { if (height == another.height) { return weight - another.weight; } else { return another.height - height; } } } }