結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
![]() |
提出日時 | 2016-09-05 13:24:14 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 81 ms / 2,000 ms |
コード長 | 1,021 bytes |
コンパイル時間 | 760 ms |
コンパイル使用メモリ | 110,036 KB |
実行使用メモリ | 34,048 KB |
最終ジャッジ日時 | 2024-07-07 11:42:55 |
合計ジャッジ時間 | 3,438 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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.Generic; namespace rummy { class Program { /// <summary> /// プログラムのエントリポイント /// </summary> /// <param name="args"></param> static void Main(string[] args) { Console.ReadLine(); string[] tmp = Console.ReadLine().Split(' '); List<int> list = new List<int>(); foreach (string s in tmp) list.Add(int.Parse(s)); list.Sort(); Console.WriteLine(JudgeInterval(list)); } private static string JudgeInterval(List<int> list) { for (int i = 0; i < list.Count - 1; i++) if (list[i] == list[i + 1]) return "NO"; int interval = list[0] - list[1]; for (int i = 1; i < list.Count - 1; i++) if (list[i] - list[i + 1] != interval) return "NO"; return "YES"; } } }