結果
| 問題 |
No.570 3人兄弟(その1)
|
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-09-07 20:37:20 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 128 ms / 2,000 ms |
| コード長 | 789 bytes |
| コンパイル時間 | 2,289 ms |
| コンパイル使用メモリ | 74,944 KB |
| 実行使用メモリ | 41,428 KB |
| 最終ジャッジ日時 | 2024-11-29 11:17:48 |
| 合計ジャッジ時間 | 3,731 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 |
ソースコード
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;
}
}
}
tenten