結果
問題 |
No.716 距離
|
ユーザー |
|
提出日時 | 2019-01-29 20:13:15 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 35 ms / 2,000 ms |
コード長 | 504 bytes |
コンパイル時間 | 2,188 ms |
コンパイル使用メモリ | 113,028 KB |
実行使用メモリ | 20,224 KB |
最終ジャッジ日時 | 2024-10-11 06:10:48 |
合計ジャッジ時間 | 5,264 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 40 |
コンパイルメッセージ
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(); var min = decimal.MaxValue; var max = Math.Abs(lst[n-1] - lst[0]); for (int i=0; i < n-1; i++) { min = Math.Min(min, Math.Abs(lst[i + 1] - lst[i])); } Console.WriteLine( min ); Console.WriteLine( max ); } }