結果
問題 |
No.716 距離
|
ユーザー |
![]() |
提出日時 | 2019-12-05 03:33:32 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 1,087 bytes |
コンパイル時間 | 938 ms |
コンパイル使用メモリ | 112,584 KB |
実行使用メモリ | 28,788 KB |
最終ジャッジ日時 | 2024-12-15 07:52:56 |
合計ジャッジ時間 | 3,632 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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.Text; using System.Linq; using System.Collections; using System.Collections.Generic; using static System.Console; using static System.Math; namespace YukiCoder { public class Program { public static void Main(string[] args) { new Program().Solve(); } public void Solve() { int n = int.Parse(ReadLine()); int[] a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); double min = Math.Pow(2, 1024); double max = -1; for (int i = 0; i < a.Length - 1; i++) { for (int j = i + 1; j <= a.Length - 1; j++) { if (a[j] - a[i] < min) { min = a[j] - a[i]; } if (a[j] - a[i] > max) { max = a[j] - a[i]; } } } WriteLine(min); WriteLine(max); } } }