結果

問題 No.135 とりあえず1次元の問題
ユーザー huffman56huffman56
提出日時 2022-07-09 18:53:40
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 708 bytes
コンパイル時間 4,443 ms
コンパイル使用メモリ 102,384 KB
実行使用メモリ 30,280 KB
最終ジャッジ日時 2023-08-30 02:55:14
合計ジャッジ時間 7,071 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
28,264 KB
testcase_01 AC 63 ms
21,816 KB
testcase_02 AC 62 ms
19,816 KB
testcase_03 WA -
testcase_04 AC 64 ms
23,812 KB
testcase_05 AC 64 ms
23,716 KB
testcase_06 AC 62 ms
21,652 KB
testcase_07 AC 64 ms
21,684 KB
testcase_08 AC 64 ms
21,760 KB
testcase_09 AC 64 ms
21,760 KB
testcase_10 AC 63 ms
19,736 KB
testcase_11 AC 65 ms
23,780 KB
testcase_12 AC 71 ms
21,908 KB
testcase_13 AC 62 ms
23,648 KB
testcase_14 AC 71 ms
23,984 KB
testcase_15 AC 71 ms
21,824 KB
testcase_16 AC 70 ms
22,004 KB
testcase_17 AC 72 ms
21,832 KB
testcase_18 AC 70 ms
23,860 KB
testcase_19 AC 71 ms
21,904 KB
testcase_20 AC 74 ms
23,876 KB
testcase_21 AC 120 ms
28,724 KB
testcase_22 AC 129 ms
30,280 KB
evil01.txt AC 136 ms
28,416 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

namespace SortItems
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Array.Sort(x);
            var ans = 1000000;

            for (var i = 0; i < n; i++)
            {
                if (i == n-1)
                {
                    break;
                }

                if (x[i] != x[i+1])
                {
                    ans = Math.Min(Math.Abs(x[i] - x[i + 1]), ans);
                }

            }

            Console.WriteLine(ans);
        }
    }
}
0