結果
問題 | No.571 3人兄弟(その2) |
ユーザー |
![]() |
提出日時 | 2019-12-07 16:45:48 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 156 ms / 2,000 ms |
コード長 | 951 bytes |
コンパイル時間 | 3,648 ms |
コンパイル使用メモリ | 74,576 KB |
実行使用メモリ | 41,240 KB |
最終ジャッジ日時 | 2024-12-25 23:48:55 |
合計ジャッジ時間 | 6,814 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
ソースコード
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;}}}}