結果

問題 No.406 鴨等間隔の法則
ユーザー TDTD
提出日時 2022-06-08 11:44:29
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 1,014 bytes
コンパイル時間 990 ms
コンパイル使用メモリ 109,132 KB
実行使用メモリ 31,356 KB
最終ジャッジ日時 2023-10-21 04:01:00
合計ジャッジ時間 5,450 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
26,568 KB
testcase_01 AC 27 ms
24,236 KB
testcase_02 AC 27 ms
24,236 KB
testcase_03 AC 27 ms
24,236 KB
testcase_04 AC 83 ms
30,864 KB
testcase_05 AC 51 ms
26,336 KB
testcase_06 AC 52 ms
26,400 KB
testcase_07 AC 52 ms
26,428 KB
testcase_08 AC 82 ms
30,820 KB
testcase_09 AC 88 ms
31,256 KB
testcase_10 AC 53 ms
26,564 KB
testcase_11 AC 76 ms
30,224 KB
testcase_12 AC 59 ms
26,608 KB
testcase_13 AC 58 ms
27,340 KB
testcase_14 AC 79 ms
30,484 KB
testcase_15 AC 35 ms
24,936 KB
testcase_16 AC 35 ms
25,008 KB
testcase_17 AC 33 ms
24,808 KB
testcase_18 AC 34 ms
25,044 KB
testcase_19 AC 36 ms
25,156 KB
testcase_20 AC 38 ms
25,324 KB
testcase_21 AC 38 ms
25,328 KB
testcase_22 AC 44 ms
25,932 KB
testcase_23 AC 62 ms
29,508 KB
testcase_24 AC 74 ms
30,040 KB
testcase_25 AC 89 ms
31,296 KB
testcase_26 AC 89 ms
31,356 KB
testcase_27 AC 77 ms
31,356 KB
testcase_28 AC 84 ms
31,320 KB
testcase_29 AC 89 ms
31,356 KB
testcase_30 AC 88 ms
31,264 KB
testcase_31 AC 85 ms
31,088 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split(' ');
            int[] b = new int[a];
            int k=0;
            int count = 0;
            for(int i = 0; i < a; i++)
            {
                b[i] = int.Parse(s[i]);
            }
            Array.Sort(b);

            for(int x = a - 1; x > 0; x--)
            {
                if (x == a - 1&& b[x] != b[x - 1])
                {
                    k = b[x] - b[x - 1];
                    count++;
                }
                else if (k==b[x] - b[x - 1] && b[x] != b[x - 1])
                {
                    count++;
                }


            }
            if (count == a - 1)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");

            }
            
        }
    }
}
0