結果

問題 No.406 鴨等間隔の法則
ユーザー nCk_cvnCk_cv
提出日時 2016-08-27 15:05:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 602 ms / 2,000 ms
コード長 520 bytes
コンパイル時間 2,689 ms
コンパイル使用メモリ 71,256 KB
実行使用メモリ 62,696 KB
最終ジャッジ日時 2023-09-21 18:03:51
合計ジャッジ時間 17,613 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 425 ms
60,348 KB
testcase_01 AC 118 ms
55,936 KB
testcase_02 AC 119 ms
55,924 KB
testcase_03 AC 119 ms
55,936 KB
testcase_04 AC 581 ms
60,672 KB
testcase_05 AC 394 ms
60,324 KB
testcase_06 AC 402 ms
60,632 KB
testcase_07 AC 404 ms
60,468 KB
testcase_08 AC 550 ms
60,624 KB
testcase_09 AC 602 ms
60,436 KB
testcase_10 AC 416 ms
60,756 KB
testcase_11 AC 521 ms
60,768 KB
testcase_12 AC 461 ms
60,372 KB
testcase_13 AC 441 ms
60,656 KB
testcase_14 AC 549 ms
60,924 KB
testcase_15 AC 205 ms
59,336 KB
testcase_16 AC 235 ms
59,716 KB
testcase_17 AC 197 ms
59,076 KB
testcase_18 AC 241 ms
59,480 KB
testcase_19 AC 253 ms
60,412 KB
testcase_20 AC 277 ms
60,388 KB
testcase_21 AC 283 ms
61,144 KB
testcase_22 AC 336 ms
60,652 KB
testcase_23 AC 456 ms
60,568 KB
testcase_24 AC 518 ms
60,776 KB
testcase_25 AC 601 ms
60,800 KB
testcase_26 AC 589 ms
61,348 KB
testcase_27 AC 538 ms
60,328 KB
testcase_28 AC 530 ms
60,652 KB
testcase_29 AC 586 ms
62,112 KB
testcase_30 AC 572 ms
62,696 KB
testcase_31 AC 557 ms
60,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;
public class Main {
		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			int N = sc.nextInt();
			int[] l = new int[N];
			for(int i = 0; i < N; i++) {
				l[i] = sc.nextInt();
			}
			Arrays.sort(l);
			int tmp = l[1] - l[0];
			boolean ok = true;
			for(int i = 1; i < N-1; i++) {
				if(tmp != l[i+1] - l[i]) {
					ok = false;
					break;
				}
			}
			if(tmp == 0) ok = false;
			
			System.out.println((ok?"YES":"NO"));
			
		}
}
0