結果
問題 | No.750 Frac #1 |
ユーザー |
|
提出日時 | 2019-02-12 19:36:21 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 173 ms / 1,000 ms |
コード長 | 605 bytes |
コンパイル時間 | 2,520 ms |
コンパイル使用メモリ | 77,916 KB |
実行使用メモリ | 55,180 KB |
最終ジャッジ日時 | 2024-09-13 09:45:56 |
合計ジャッジ時間 | 9,287 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
import java.util.*; class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int n = sc.nextInt(); Bunsu[] ar = new Bunsu[n]; for (int i=0; i<n; i++) { ar[i] = new Bunsu(sc.nextInt(), sc.nextInt()); } Arrays.sort(ar, Comparator.comparing(Bunsu::getShosu).reversed()); for (int i=0; i<n; i++) { System.out.println((int)ar[i].bunsi+" "+(int)ar[i].bunbo); } } } class Bunsu { double bunsi; double bunbo; double shosu; Bunsu(double a, double b) { bunsi = a; bunbo = b; shosu = a/b; } double getShosu() {return shosu;} }