結果

問題 No.406 鴨等間隔の法則
ユーザー swdamdrswdamdr
提出日時 2017-01-26 14:59:31
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 788 bytes
コンパイル時間 2,894 ms
コンパイル使用メモリ 106,712 KB
実行使用メモリ 30,436 KB
最終ジャッジ日時 2023-09-21 18:22:04
合計ジャッジ時間 7,341 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
25,612 KB
testcase_01 AC 59 ms
19,568 KB
testcase_02 AC 60 ms
23,736 KB
testcase_03 AC 60 ms
21,740 KB
testcase_04 AC 124 ms
30,436 KB
testcase_05 AC 89 ms
23,492 KB
testcase_06 AC 91 ms
23,608 KB
testcase_07 AC 90 ms
23,448 KB
testcase_08 AC 123 ms
28,520 KB
testcase_09 AC 129 ms
28,852 KB
testcase_10 AC 93 ms
23,708 KB
testcase_11 AC 119 ms
29,924 KB
testcase_12 AC 99 ms
24,172 KB
testcase_13 AC 96 ms
24,516 KB
testcase_14 AC 119 ms
28,352 KB
testcase_15 AC 71 ms
22,112 KB
testcase_16 AC 73 ms
22,320 KB
testcase_17 AC 71 ms
24,000 KB
testcase_18 AC 72 ms
24,208 KB
testcase_19 AC 73 ms
22,388 KB
testcase_20 AC 75 ms
24,400 KB
testcase_21 AC 75 ms
22,404 KB
testcase_22 AC 81 ms
25,044 KB
testcase_23 AC 101 ms
26,660 KB
testcase_24 AC 112 ms
29,864 KB
testcase_25 AC 131 ms
29,100 KB
testcase_26 AC 130 ms
27,136 KB
testcase_27 AC 119 ms
29,024 KB
testcase_28 AC 124 ms
28,996 KB
testcase_29 AC 129 ms
29,076 KB
testcase_30 AC 130 ms
29,040 KB
testcase_31 AC 125 ms
26,820 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.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int[] x = Console.ReadLine().Split().Select(v => int.Parse(v)).ToArray();

        Array.Sort(x);

        if (Judge(x))
        {
            Console.WriteLine("YES");
        }
        else
        {
            Console.WriteLine("NO");
        }

        Console.Read();
    }

    static bool Judge(int[] x)
    {
        int n = x[1] - x[0];

        if (n == 0)
        {
            return false;
        }

        for (int i = 2; i < x.Length - 1; i++)
        {
            if (x[i + 1] - x[i] != n)
            {
                return false;
            }
        }

        return true;
    }
}
0