結果

問題 No.406 鴨等間隔の法則
ユーザー CroweaCrowea
提出日時 2019-02-01 17:44:32
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 150 ms / 2,000 ms
コード長 622 bytes
コンパイル時間 1,139 ms
コンパイル使用メモリ 67,704 KB
実行使用メモリ 33,824 KB
最終ジャッジ日時 2023-09-21 18:57:48
合計ジャッジ時間 6,361 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
25,108 KB
testcase_01 AC 65 ms
22,024 KB
testcase_02 AC 65 ms
24,012 KB
testcase_03 AC 63 ms
19,796 KB
testcase_04 AC 141 ms
31,100 KB
testcase_05 AC 96 ms
24,576 KB
testcase_06 AC 98 ms
24,596 KB
testcase_07 AC 97 ms
24,676 KB
testcase_08 AC 141 ms
31,132 KB
testcase_09 AC 147 ms
31,612 KB
testcase_10 AC 103 ms
25,044 KB
testcase_11 AC 133 ms
32,212 KB
testcase_12 AC 109 ms
25,652 KB
testcase_13 AC 107 ms
25,480 KB
testcase_14 AC 136 ms
30,700 KB
testcase_15 AC 75 ms
22,616 KB
testcase_16 AC 76 ms
22,756 KB
testcase_17 AC 75 ms
24,372 KB
testcase_18 AC 76 ms
22,732 KB
testcase_19 AC 78 ms
22,896 KB
testcase_20 AC 82 ms
23,052 KB
testcase_21 AC 81 ms
25,216 KB
testcase_22 AC 88 ms
23,912 KB
testcase_23 AC 112 ms
27,860 KB
testcase_24 AC 128 ms
31,972 KB
testcase_25 AC 150 ms
31,720 KB
testcase_26 AC 150 ms
33,824 KB
testcase_27 AC 128 ms
31,932 KB
testcase_28 AC 148 ms
31,904 KB
testcase_29 AC 149 ms
31,760 KB
testcase_30 AC 149 ms
29,668 KB
testcase_31 AC 147 ms
33,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Linq;

public class Program
{
    public static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var input = Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).OrderBy(x => x).ToArray();

        var dist = input[1] - input[0];
        for (int i=0; i < input.Length - 1 ; i++)
        {
            if (input[i] == input[i + 1]) { Console.WriteLine("NO"); return; }
            else
            {
                if (input[i+1] - input[i] != dist) { Console.WriteLine("NO"); return; }
            }
        }
        Console.WriteLine("YES");
    }
}
0