結果
| 問題 |
No.750 Frac #1
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-04 09:58:50 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 25 ms / 1,000 ms |
| コード長 | 1,072 bytes |
| コンパイル時間 | 870 ms |
| コンパイル使用メモリ | 114,092 KB |
| 実行使用メモリ | 19,328 KB |
| 最終ジャッジ日時 | 2024-07-06 13:35:23 |
| 合計ジャッジ時間 | 3,029 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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.
ソースコード
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; }
}
}