結果
問題 |
No.716 距離
|
ユーザー |
|
提出日時 | 2019-01-29 20:09:57 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 572 bytes |
コンパイル時間 | 927 ms |
コンパイル使用メモリ | 112,140 KB |
実行使用メモリ | 30,024 KB |
最終ジャッジ日時 | 2024-10-11 06:10:51 |
合計ジャッジ時間 | 3,402 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 WA * 21 |
コンパイルメッセージ
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; class Program { static void Main(string[] args) { var n = int.Parse(Console.ReadLine()); var lst = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList(); lst.Sort(); var min = decimal.MaxValue; var max = Math.Abs(lst[n-1] - lst[0]); for (int i=0; i < n-1; i++) { if (lst[i] == lst[i + 1]) continue; min = Math.Min(min, Math.Abs(lst[i + 1] - lst[i])); } Console.WriteLine( min ); Console.WriteLine( max ); } }