結果
問題 |
No.571 3人兄弟(その2)
|
ユーザー |
![]() |
提出日時 | 2017-12-31 18:01:17 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 133 ms / 2,000 ms |
コード長 | 869 bytes |
コンパイル時間 | 2,559 ms |
コンパイル使用メモリ | 78,308 KB |
実行使用メモリ | 41,508 KB |
最終ジャッジ日時 | 2024-12-21 15:31:11 |
合計ジャッジ時間 | 5,448 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
ソースコード
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); } } }