結果

問題 No.406 鴨等間隔の法則
ユーザー funakoshifunakoshi
提出日時 2019-06-28 10:38:51
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 1,231 bytes
コンパイル時間 2,503 ms
コンパイル使用メモリ 102,984 KB
実行使用メモリ 30,200 KB
最終ジャッジ日時 2023-09-21 19:03:35
合計ジャッジ時間 6,302 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
24,916 KB
testcase_01 AC 55 ms
22,700 KB
testcase_02 AC 55 ms
20,720 KB
testcase_03 AC 55 ms
20,772 KB
testcase_04 AC 114 ms
29,768 KB
testcase_05 AC 81 ms
22,712 KB
testcase_06 AC 83 ms
22,736 KB
testcase_07 AC 83 ms
22,808 KB
testcase_08 AC 114 ms
27,732 KB
testcase_09 AC 120 ms
30,200 KB
testcase_10 AC 86 ms
22,924 KB
testcase_11 AC 107 ms
29,188 KB
testcase_12 AC 91 ms
23,360 KB
testcase_13 AC 90 ms
25,708 KB
testcase_14 AC 110 ms
29,480 KB
testcase_15 AC 66 ms
21,252 KB
testcase_16 AC 67 ms
23,372 KB
testcase_17 AC 64 ms
23,188 KB
testcase_18 AC 66 ms
21,420 KB
testcase_19 AC 67 ms
21,556 KB
testcase_20 AC 69 ms
21,700 KB
testcase_21 AC 70 ms
21,644 KB
testcase_22 AC 75 ms
24,300 KB
testcase_23 AC 93 ms
27,920 KB
testcase_24 AC 105 ms
29,032 KB
testcase_25 AC 119 ms
28,164 KB
testcase_26 AC 121 ms
28,224 KB
testcase_27 AC 107 ms
28,272 KB
testcase_28 AC 114 ms
28,216 KB
testcase_29 AC 123 ms
28,336 KB
testcase_30 AC 119 ms
30,196 KB
testcase_31 AC 117 ms
28,076 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;
using System.Text;
using System.Threading.Tasks;

namespace yukicoderTest
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            string[] input2 = Console.ReadLine().Split(' ');
            int n = int.Parse(input);
            int[] kamo = new int[input2.Length];
            bool flg = true;
            for(int i=0;i<kamo.Length;i++)
            {
                kamo[i] = int.Parse(input2[i]);
            }
            Array.Sort(kamo);
            Array.Reverse(kamo);
            int sa = kamo[0] - kamo[1];
            
            for (int i = 0; i < kamo.Length - 1; i++)
            {
                if (sa != kamo[i] - kamo[i + 1])
                {
                    flg = false;
                    break;
                }
                else if(sa==0)
                {
                    flg = false;
                    break;
                }
            }
            if(flg==true)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }

    }
}
0