結果

問題 No.406 鴨等間隔の法則
ユーザー tsunabittsunabit
提出日時 2018-06-23 11:44:12
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 589 bytes
コンパイル時間 3,655 ms
コンパイル使用メモリ 77,884 KB
実行使用メモリ 70,088 KB
最終ジャッジ日時 2023-09-13 08:20:34
合計ジャッジ時間 17,048 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 350 ms
60,596 KB
testcase_01 AC 121 ms
56,140 KB
testcase_02 AC 124 ms
56,388 KB
testcase_03 WA -
testcase_04 AC 449 ms
66,656 KB
testcase_05 AC 328 ms
60,272 KB
testcase_06 AC 335 ms
60,752 KB
testcase_07 AC 338 ms
60,220 KB
testcase_08 AC 458 ms
66,284 KB
testcase_09 AC 504 ms
69,316 KB
testcase_10 AC 347 ms
59,768 KB
testcase_11 AC 443 ms
66,604 KB
testcase_12 AC 358 ms
64,452 KB
testcase_13 AC 351 ms
60,436 KB
testcase_14 AC 452 ms
66,280 KB
testcase_15 WA -
testcase_16 AC 209 ms
58,224 KB
testcase_17 AC 192 ms
55,744 KB
testcase_18 AC 221 ms
59,564 KB
testcase_19 AC 230 ms
59,896 KB
testcase_20 AC 242 ms
60,156 KB
testcase_21 AC 243 ms
59,428 KB
testcase_22 AC 285 ms
60,092 KB
testcase_23 AC 372 ms
64,784 KB
testcase_24 AC 446 ms
66,488 KB
testcase_25 AC 490 ms
67,452 KB
testcase_26 AC 508 ms
69,956 KB
testcase_27 WA -
testcase_28 AC 428 ms
68,668 KB
testcase_29 AC 507 ms
70,088 KB
testcase_30 AC 504 ms
69,948 KB
testcase_31 AC 496 ms
69,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.util.stream.Stream;

public class No406 {
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		int[] x = Stream.of(sc.nextLine().split(" ", 0)).mapToInt(Integer::parseInt).toArray();
		Arrays.sort(x);
		String out = "YES";
		int temp = x[1] - x[0];
		for(int i = 0; i < n - 1; i++){
		    if(temp != x[i + 1] - x[i]) {;
				out = "NO";
				break;
			}
		}
		System.out.println(out);
	}
}
0