結果
| 問題 |
No.406 鴨等間隔の法則
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-13 21:41:14 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 82 ms / 2,000 ms |
| コード長 | 560 bytes |
| コンパイル時間 | 916 ms |
| コンパイル使用メモリ | 107,008 KB |
| 実行使用メモリ | 28,544 KB |
| 最終ジャッジ日時 | 2024-07-07 11:51:16 |
| 合計ジャッジ時間 | 3,504 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections;
using System.Linq;
class Program
{
static void Main()
{
int n = int.Parse(Console.ReadLine()); //数字1つを読み込み
int[] xs = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
Array.Sort(xs);
int sa = xs[1] - xs[0];
bool check = true;
for (int i = 1; i < n; i++)
{
if (sa != xs[i] - xs[i - 1])
{
check = false;
break;
}
}
if (sa == 0)
{
check = false;
}
if (check)
{
Console.WriteLine("YES");
}
else {
Console.WriteLine("NO");
}
}
}