結果
問題 | No.750 Frac #1 |
ユーザー |
|
提出日時 | 2020-03-02 00:55:22 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 27 ms / 1,000 ms |
コード長 | 927 bytes |
コンパイル時間 | 738 ms |
コンパイル使用メモリ | 114,448 KB |
実行使用メモリ | 19,328 KB |
最終ジャッジ日時 | 2024-10-13 20:53:56 |
合計ジャッジ時間 | 2,546 ms |
ジャッジサーバーID (参考情報) |
judge4 / 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.
ソースコード
using System; using System.Linq; public class Hello{ public static void Main(){ int n= int.Parse(Console.ReadLine()); string[] line = new string[n]; for(int i=0;i<n;i++) line[i] = Console.ReadLine(); float[] tmps = new float[2]; float a=0, b=0; string tmp=""; for(int j=0;j<n-1;j++){ for(int i=0;i<n-1;i++){ tmps = line[i].Split().Select(float.Parse).ToArray(); a = tmps[0]/tmps[1]; tmps = line[i+1].Split().Select(float.Parse).ToArray(); b = tmps[0]/tmps[1]; if(a<b){ tmp = line[i]; line[i]=line[i+1]; line[i+1] = tmp; } } } foreach(string i in line) Console.WriteLine(i); } }