結果

問題 No.406 鴨等間隔の法則
ユーザー chankou0920chankou0920
提出日時 2017-11-06 12:23:40
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 578 bytes
コンパイル時間 2,200 ms
コンパイル使用メモリ 102,436 KB
実行使用メモリ 30,208 KB
最終ジャッジ日時 2023-09-21 18:41:46
合計ジャッジ時間 6,653 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
24,852 KB
testcase_01 AC 57 ms
20,664 KB
testcase_02 AC 56 ms
20,516 KB
testcase_03 AC 57 ms
22,892 KB
testcase_04 AC 116 ms
27,696 KB
testcase_05 AC 84 ms
22,448 KB
testcase_06 AC 84 ms
22,612 KB
testcase_07 AC 84 ms
22,676 KB
testcase_08 AC 115 ms
27,604 KB
testcase_09 AC 121 ms
27,996 KB
testcase_10 AC 88 ms
23,020 KB
testcase_11 AC 109 ms
27,132 KB
testcase_12 AC 92 ms
23,212 KB
testcase_13 AC 90 ms
23,736 KB
testcase_14 AC 113 ms
27,192 KB
testcase_15 AC 67 ms
21,192 KB
testcase_16 AC 69 ms
21,412 KB
testcase_17 AC 66 ms
23,120 KB
testcase_18 AC 68 ms
21,176 KB
testcase_19 AC 70 ms
21,612 KB
testcase_20 AC 71 ms
23,628 KB
testcase_21 AC 71 ms
21,584 KB
testcase_22 AC 77 ms
24,128 KB
testcase_23 AC 96 ms
25,736 KB
testcase_24 AC 108 ms
26,940 KB
testcase_25 AC 122 ms
28,136 KB
testcase_26 AC 121 ms
28,092 KB
testcase_27 AC 110 ms
30,208 KB
testcase_28 AC 118 ms
28,124 KB
testcase_29 AC 123 ms
28,132 KB
testcase_30 AC 121 ms
26,160 KB
testcase_31 AC 119 ms
29,900 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Program {
	public void Solve() {
		Console.ReadLine();  // N
		string[] s = Console.ReadLine().Split(' ');
		
		int[] x = new int[s.Length];
		for (int i = 0; i < x.Length; i++) {
			x[i] = int.Parse(s[i]);
		}
		Array.Sort(x);
		
		int diff = x[1] - x[0];
		for (int i = 2; i < x.Length; i++) {
			if (x[i] - x[i - 1] != diff || x[i] - x[i - 1] == 0 || diff == 0) {
				Console.WriteLine("NO");
				return;
			}
		}
		Console.WriteLine("YES");
	}
	
	public static void Main(string[] args) {
		Program program = new Program();
		program.Solve();
	}
}
0