結果

問題 No.406 鴨等間隔の法則
ユーザー fuzuirfuzuir
提出日時 2016-10-13 21:41:14
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 560 bytes
コンパイル時間 2,198 ms
コンパイル使用メモリ 106,132 KB
実行使用メモリ 31,208 KB
最終ジャッジ日時 2023-09-21 18:15:51
合計ジャッジ時間 6,943 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
23,684 KB
testcase_01 AC 62 ms
23,764 KB
testcase_02 AC 61 ms
23,684 KB
testcase_03 AC 62 ms
21,716 KB
testcase_04 AC 120 ms
28,616 KB
testcase_05 AC 88 ms
23,660 KB
testcase_06 AC 89 ms
23,612 KB
testcase_07 AC 89 ms
23,688 KB
testcase_08 AC 120 ms
30,624 KB
testcase_09 AC 125 ms
31,016 KB
testcase_10 AC 91 ms
23,836 KB
testcase_11 AC 114 ms
27,900 KB
testcase_12 AC 96 ms
24,124 KB
testcase_13 AC 95 ms
26,572 KB
testcase_14 AC 116 ms
28,256 KB
testcase_15 AC 72 ms
22,308 KB
testcase_16 AC 73 ms
22,108 KB
testcase_17 AC 71 ms
22,024 KB
testcase_18 AC 72 ms
24,128 KB
testcase_19 AC 74 ms
22,364 KB
testcase_20 AC 76 ms
24,480 KB
testcase_21 AC 75 ms
22,440 KB
testcase_22 AC 82 ms
21,064 KB
testcase_23 AC 104 ms
28,740 KB
testcase_24 AC 108 ms
27,832 KB
testcase_25 AC 125 ms
29,004 KB
testcase_26 AC 125 ms
29,096 KB
testcase_27 AC 114 ms
31,208 KB
testcase_28 AC 120 ms
29,056 KB
testcase_29 AC 125 ms
31,168 KB
testcase_30 AC 124 ms
30,992 KB
testcase_31 AC 123 ms
26,772 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
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");
		}
	}
}
0