結果
| 問題 |
No.406 鴨等間隔の法則
|
| ユーザー |
|
| 提出日時 | 2020-03-28 13:24:20 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 95 ms / 2,000 ms |
| コード長 | 488 bytes |
| コンパイル時間 | 800 ms |
| コンパイル使用メモリ | 108,568 KB |
| 実行使用メモリ | 29,056 KB |
| 最終ジャッジ日時 | 2024-07-07 13:05:15 |
| 合計ジャッジ時間 | 4,050 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / 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.Linq;
public class P0406 {
public static void Main() {
var n = int.Parse(Console.ReadLine().Trim());
var x = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToList();
x.Sort();
var result = x.SkipLast(1).Zip(x.Skip(1), (i, j) => j - i).Distinct().ToList();
if(result.Count() == 1 && result[0] > 0) {
Console.WriteLine("YES");
} else {
Console.WriteLine("NO");
}
}
}