結果

問題 No.716 距離
ユーザー mame_shibemame_shibe
提出日時 2019-12-05 03:33:32
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 1,087 bytes
コンパイル時間 2,069 ms
コンパイル使用メモリ 65,660 KB
実行使用メモリ 26,324 KB
最終ジャッジ日時 2023-08-21 18:12:57
合計ジャッジ時間 6,376 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
26,104 KB
testcase_01 AC 76 ms
26,324 KB
testcase_02 AC 76 ms
24,360 KB
testcase_03 AC 76 ms
22,252 KB
testcase_04 AC 76 ms
24,184 KB
testcase_05 AC 77 ms
24,256 KB
testcase_06 AC 76 ms
24,092 KB
testcase_07 AC 67 ms
24,168 KB
testcase_08 AC 66 ms
26,044 KB
testcase_09 AC 67 ms
25,908 KB
testcase_10 AC 76 ms
26,312 KB
testcase_11 AC 74 ms
22,128 KB
testcase_12 AC 77 ms
26,196 KB
testcase_13 AC 75 ms
24,216 KB
testcase_14 AC 66 ms
22,000 KB
testcase_15 AC 77 ms
26,204 KB
testcase_16 AC 75 ms
24,184 KB
testcase_17 AC 78 ms
26,224 KB
testcase_18 AC 68 ms
22,028 KB
testcase_19 AC 75 ms
24,200 KB
testcase_20 AC 66 ms
24,000 KB
testcase_21 AC 73 ms
24,352 KB
testcase_22 AC 74 ms
26,140 KB
testcase_23 AC 67 ms
26,056 KB
testcase_24 AC 76 ms
24,204 KB
testcase_25 AC 75 ms
24,060 KB
testcase_26 AC 76 ms
24,380 KB
testcase_27 AC 76 ms
24,164 KB
testcase_28 AC 66 ms
23,936 KB
testcase_29 AC 75 ms
24,308 KB
testcase_30 AC 76 ms
26,176 KB
testcase_31 AC 76 ms
26,252 KB
testcase_32 AC 76 ms
26,248 KB
testcase_33 AC 76 ms
24,336 KB
testcase_34 AC 75 ms
24,184 KB
testcase_35 AC 67 ms
22,140 KB
testcase_36 AC 74 ms
26,024 KB
testcase_37 AC 66 ms
23,940 KB
testcase_38 AC 74 ms
24,180 KB
testcase_39 AC 75 ms
24,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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);
        }
    }
}
0