結果

問題 No.406 鴨等間隔の法則
ユーザー funakoshifunakoshi
提出日時 2019-06-27 17:53:34
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 1,730 bytes
コンパイル時間 2,841 ms
コンパイル使用メモリ 104,588 KB
実行使用メモリ 36,644 KB
最終ジャッジ日時 2023-09-10 12:47:41
合計ジャッジ時間 8,419 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
31,448 KB
testcase_01 AC 59 ms
24,840 KB
testcase_02 AC 57 ms
22,672 KB
testcase_03 AC 58 ms
20,668 KB
testcase_04 AC 127 ms
33,956 KB
testcase_05 AC 86 ms
26,644 KB
testcase_06 AC 88 ms
24,760 KB
testcase_07 AC 88 ms
24,780 KB
testcase_08 AC 127 ms
35,684 KB
testcase_09 AC 135 ms
36,644 KB
testcase_10 AC 91 ms
25,100 KB
testcase_11 AC 120 ms
36,644 KB
testcase_12 AC 99 ms
29,628 KB
testcase_13 AC 93 ms
25,872 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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];
            int[] sa = new int[kamo.Length - 1];
            bool flg = true;
            for (int i = 0; i < input2.Length; i++)
            {
                kamo[i] = int.Parse(input2[i]);
            }
            Array.Sort(kamo);
            Array.Reverse(kamo);
            for (int i = 0; i < kamo.Length-1; i++)
            {
                sa[i] = kamo[i] - kamo[i + 1];
            }
            for(int i=0;i<sa.Length-1;i++)
            {
                int sa1 = sa[i];
                int sa2 = sa[i + 1];
                if(sa1!=sa2)
                {
                    flg = false;
                    break;
                }
            }

            for (int i = 0; i < kamo.Length - 1; i++)
            {
                
                for (int j = i + 1; j < kamo.Length; j++)
                {
                    if (Equals(kamo[i], kamo[j]))
                    {
                        flg = false;
                        break;
                    }

                }
                if (flg == false)
                {
                    break;
                }
            }
            if (flg==true)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }

    }
}
0