結果

問題 No.750 Frac #1
ユーザー Charlotte8687Charlotte8687
提出日時 2018-12-04 09:58:50
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 70 ms / 1,000 ms
コード長 1,072 bytes
コンパイル時間 2,490 ms
コンパイル使用メモリ 110,544 KB
実行使用メモリ 24,020 KB
最終ジャッジ日時 2023-09-20 18:42:09
合計ジャッジ時間 7,024 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
24,020 KB
testcase_01 AC 68 ms
21,876 KB
testcase_02 AC 69 ms
19,856 KB
testcase_03 AC 68 ms
21,808 KB
testcase_04 AC 69 ms
21,772 KB
testcase_05 AC 69 ms
21,916 KB
testcase_06 AC 70 ms
23,860 KB
testcase_07 AC 68 ms
21,844 KB
testcase_08 AC 67 ms
21,928 KB
testcase_09 AC 69 ms
23,888 KB
testcase_10 AC 69 ms
21,764 KB
testcase_11 AC 68 ms
22,088 KB
testcase_12 AC 69 ms
23,868 KB
testcase_13 AC 70 ms
21,796 KB
testcase_14 AC 68 ms
21,932 KB
testcase_15 AC 67 ms
23,924 KB
testcase_16 AC 70 ms
23,904 KB
testcase_17 AC 69 ms
21,976 KB
testcase_18 AC 69 ms
21,768 KB
testcase_19 AC 70 ms
23,792 KB
testcase_20 AC 69 ms
21,960 KB
testcase_21 AC 69 ms
19,780 KB
testcase_22 AC 70 ms
21,932 KB
testcase_23 AC 70 ms
23,852 KB
testcase_24 AC 70 ms
21,904 KB
testcase_25 AC 70 ms
23,964 KB
testcase_26 AC 69 ms
21,792 KB
testcase_27 AC 69 ms
21,968 KB
testcase_28 AC 66 ms
21,772 KB
testcase_29 AC 69 ms
19,876 KB
testcase_30 AC 68 ms
21,880 KB
testcase_31 AC 69 ms
21,904 KB
testcase_32 AC 70 ms
21,972 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

namespace StudyApp
{
    class Program
    {
        static void Main(string[] args)
        {
            int num = int.Parse(Console.ReadLine());
            var fractions = new List<Fraction>();

            for (int i = 0; i < num; i++)
            {
                string[] data = Console.ReadLine().Trim().Split(' ');
                int top = int.Parse(data[0]);
                int bottom = int.Parse(data[1]);
                fractions.Add(new Fraction
                {
                    Top = top,
                    Bottom = bottom,
                    Decimal = (double)top / (double)bottom
                });
            }

            var results = fractions.OrderByDescending(data => data.Decimal);

            foreach (var result in results)
                Console.WriteLine($"{result.Top} {result.Bottom}");
        }
    }

    struct Fraction
    {
        public int Top { get; set; }
        public int Bottom { get; set; }
        public double Decimal { get; set; }
    }
}
0