結果

問題 No.135 とりあえず1次元の問題
ユーザー wowilsonwowilson
提出日時 2016-10-08 19:44:13
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 741 bytes
コンパイル時間 3,593 ms
コンパイル使用メモリ 107,328 KB
実行使用メモリ 29,124 KB
最終ジャッジ日時 2023-09-02 00:36:20
合計ジャッジ時間 6,601 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
28,688 KB
testcase_01 AC 64 ms
21,824 KB
testcase_02 AC 64 ms
23,672 KB
testcase_03 AC 64 ms
21,628 KB
testcase_04 AC 64 ms
21,776 KB
testcase_05 AC 63 ms
21,812 KB
testcase_06 AC 64 ms
21,660 KB
testcase_07 AC 64 ms
23,680 KB
testcase_08 AC 64 ms
21,644 KB
testcase_09 AC 63 ms
21,592 KB
testcase_10 AC 63 ms
19,604 KB
testcase_11 AC 63 ms
19,744 KB
testcase_12 AC 72 ms
21,844 KB
testcase_13 AC 64 ms
21,620 KB
testcase_14 AC 72 ms
23,736 KB
testcase_15 AC 72 ms
23,832 KB
testcase_16 AC 73 ms
21,796 KB
testcase_17 AC 72 ms
23,840 KB
testcase_18 AC 71 ms
23,836 KB
testcase_19 AC 72 ms
23,888 KB
testcase_20 AC 72 ms
23,944 KB
testcase_21 AC 116 ms
29,124 KB
testcase_22 AC 128 ms
28,668 KB
evil01.txt AC 126 ms
30,788 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 Yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            List<int> ary = new List<int>();
            ary.AddRange(Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray());
            ary.Sort();

            int dif = 0;
            for (int i = 1; i < ary.Count; i++)
            {
                int tmp = ary[i] - ary[i - 1];

                if (tmp == 0)
                {
                    continue;
                }

                dif = dif == 0 ? tmp : dif > tmp ? tmp : dif;
            }
            Console.WriteLine(dif);
        }
    }
}
0