結果

問題 No.406 鴨等間隔の法則
ユーザー jin128
提出日時 2016-08-30 01:18:41
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 508 bytes
コンパイル時間 2,435 ms
コンパイル使用メモリ 103,808 KB
実行使用メモリ 21,120 KB
最終ジャッジ日時 2024-11-07 05:30:28
合計ジャッジ時間 4,896 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

class S25_duck{
  public static int Main(string[] args){
    int n;
    string ans = "YES";
    n = int.Parse(Console.ReadLine());
    int[] duck = new int[n];

    for(int i = 0; i < n; i++){
      duck[i] = int.Parse(Console.ReadLine());
    }

    Array.Sort(duck);

    int a = duck[1] - duck[0];
    for(int i = 2; i < n; i++){
      if((duck[i] - duck[i-1] != a) || duck[i] == duck[i-i]){
        ans = "NO";
        break;
      }
    }

    Console.WriteLine(ans);
    return 0;
  }
}
0