結果

問題 No.750 Frac #1
ユーザー abL8ZLsTbF
提出日時 2018-11-09 21:42:11
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 35 ms / 1,000 ms
コード長 839 bytes
コンパイル時間 1,011 ms
コンパイル使用メモリ 111,924 KB
実行使用メモリ 29,512 KB
最終ジャッジ日時 2024-11-21 05:44:49
合計ジャッジ時間 2,756 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        Fraction[] frac = new Fraction[n];
        for (int i = 0; i < n; i++)
        {
            var AB = Console.ReadLine().Split().Select(int.Parse);
            frac[i] = new Fraction { Numerator = AB.First(), Denominator = AB.Last() };
        }
        frac = frac.OrderByDescending(i => i.Numerator / (double)i.Denominator).ToArray();
        foreach (var item in frac)
        {
            Console.WriteLine($"{item.Numerator} {item.Denominator}");
        }
    }
}

public class Fraction
{
    public int Numerator { get; set; }  // 分子
    public int Denominator { get; set; }    // 分母
}
0