結果
| 問題 | 
                            No.750 Frac #1
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tenten
                         | 
                    
| 提出日時 | 2020-12-09 18:44:25 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 165 ms / 1,000 ms | 
| コード長 | 946 bytes | 
| コンパイル時間 | 2,476 ms | 
| コンパイル使用メモリ | 81,884 KB | 
| 実行使用メモリ | 42,588 KB | 
| 最終ジャッジ日時 | 2024-09-19 01:36:22 | 
| 合計ジャッジ時間 | 9,144 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 30 | 
ソースコード
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Num[] nums = new Num[n];
        for (int i = 0; i < n; i++) {
            nums[i] = new Num(sc.nextInt(), sc.nextInt());
        }
        Arrays.sort(nums);
        StringBuilder sb = new StringBuilder();
        for (Num x : nums) {
            sb.append(x).append("\n");
        }
        System.out.print(sb);
    }
    
    static class Num implements Comparable<Num> {
        int child;
        int mother;
        
        public Num(int child, int mother) {
            this.child = child;
            this.mother = mother;
        }
        
        public int compareTo(Num another) {
            return another.child * mother - child * another.mother;
        }
        
        public String toString() {
            return child + " " + mother;
        }
    }
}
            
            
            
        
            
tenten