結果

問題 No.406 鴨等間隔の法則
ユーザー tsunabit
提出日時 2018-06-23 11:44:12
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 589 bytes
コンパイル時間 3,609 ms
コンパイル使用メモリ 80,108 KB
実行使用メモリ 67,108 KB
最終ジャッジ日時 2024-06-30 18:17:27
合計ジャッジ時間 16,637 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 27 WA * 2
権限があれば一括ダウンロードができます

ソースコード

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