結果

問題 No.716 距離
ユーザー mame_shibemame_shibe
提出日時 2019-12-05 03:14:21
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,116 bytes
コンパイル時間 1,323 ms
コンパイル使用メモリ 66,196 KB
実行使用メモリ 26,084 KB
最終ジャッジ日時 2023-08-21 17:45:32
合計ジャッジ時間 6,078 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
21,972 KB
testcase_01 AC 71 ms
21,900 KB
testcase_02 AC 71 ms
21,860 KB
testcase_03 AC 71 ms
21,848 KB
testcase_04 AC 71 ms
21,908 KB
testcase_05 AC 71 ms
21,816 KB
testcase_06 AC 72 ms
21,828 KB
testcase_07 AC 63 ms
21,784 KB
testcase_08 AC 63 ms
21,856 KB
testcase_09 AC 62 ms
21,660 KB
testcase_10 AC 71 ms
21,804 KB
testcase_11 WA -
testcase_12 AC 70 ms
21,800 KB
testcase_13 AC 70 ms
21,864 KB
testcase_14 AC 62 ms
23,736 KB
testcase_15 AC 72 ms
19,756 KB
testcase_16 WA -
testcase_17 AC 72 ms
21,792 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 71 ms
21,808 KB
testcase_25 AC 70 ms
23,888 KB
testcase_26 WA -
testcase_27 AC 70 ms
21,852 KB
testcase_28 WA -
testcase_29 AC 70 ms
21,924 KB
testcase_30 WA -
testcase_31 AC 70 ms
19,708 KB
testcase_32 AC 69 ms
21,892 KB
testcase_33 WA -
testcase_34 AC 71 ms
21,804 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 71 ms
21,860 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();
            Array.Sort(a);

            bool isDuplicated = false;
            for (int i = 0; i < a.Length - 1; i++)
            {
                for (int j = i + 1; j < a.Length; j++)
                {
                    if (a[i] == a[j]) isDuplicated = true;
                }
                
            }

            int min;
            if (isDuplicated) // same num
            {
                min = 0;
            }
            else
            {
                min = Abs(a[0] - a[1]);
            }
            
            WriteLine(min);
            WriteLine(Abs(a[0] - a[a.Length -1]));

        }
    }
}
0