結果

問題 No.406 鴨等間隔の法則
ユーザー fal_rndfal_rnd
提出日時 2016-10-28 23:34:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 641 ms / 2,000 ms
コード長 416 bytes
コンパイル時間 2,180 ms
コンパイル使用メモリ 72,432 KB
実行使用メモリ 61,664 KB
最終ジャッジ日時 2023-09-21 18:18:38
合計ジャッジ時間 17,920 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 456 ms
60,928 KB
testcase_01 AC 124 ms
55,768 KB
testcase_02 AC 125 ms
55,884 KB
testcase_03 AC 127 ms
55,804 KB
testcase_04 AC 612 ms
60,772 KB
testcase_05 AC 413 ms
61,072 KB
testcase_06 AC 417 ms
60,728 KB
testcase_07 AC 419 ms
60,660 KB
testcase_08 AC 592 ms
61,336 KB
testcase_09 AC 641 ms
60,664 KB
testcase_10 AC 439 ms
60,544 KB
testcase_11 AC 558 ms
60,952 KB
testcase_12 AC 483 ms
61,020 KB
testcase_13 AC 486 ms
60,976 KB
testcase_14 AC 586 ms
60,864 KB
testcase_15 AC 220 ms
59,256 KB
testcase_16 AC 251 ms
59,904 KB
testcase_17 AC 215 ms
58,944 KB
testcase_18 AC 251 ms
59,456 KB
testcase_19 AC 268 ms
60,548 KB
testcase_20 AC 288 ms
61,044 KB
testcase_21 AC 301 ms
60,144 KB
testcase_22 AC 355 ms
60,516 KB
testcase_23 AC 504 ms
60,812 KB
testcase_24 AC 544 ms
60,928 KB
testcase_25 AC 626 ms
60,868 KB
testcase_26 AC 601 ms
61,440 KB
testcase_27 AC 583 ms
60,968 KB
testcase_28 AC 563 ms
58,872 KB
testcase_29 AC 591 ms
61,664 KB
testcase_30 AC 587 ms
60,664 KB
testcase_31 AC 597 ms
61,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class A{
	static Scanner s = new Scanner(System.in);
	public static void main(String[] args) {
		int in[] = new int[s.nextInt()];
		for(int i=0;i<in.length;i++) {
			in[i]=s.nextInt();
		}
		Arrays.sort(in);
		int f = in[1]-in[0];
		for(int i=2;i<in.length;i++) {
			if((f != in[i]-in[i-1])||(in[i]==in[i-1])) {
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	}
}
0