結果

問題 No.406 鴨等間隔の法則
ユーザー FVRChan
提出日時 2017-10-05 10:13:11
言語 Java
(openjdk 23)
結果
AC  
実行時間 623 ms / 2,000 ms
コード長 494 bytes
コンパイル時間 1,933 ms
コンパイル使用メモリ 74,756 KB
実行使用メモリ 50,288 KB
最終ジャッジ日時 2024-07-07 12:21:02
合計ジャッジ時間 16,876 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;
public class Main{
	private static Scanner sc=new Scanner(System.in);
	public static void main(String args[])throws Exception{
		int n=sc.nextInt();
		int are[]=new int[n];
		for(int i=0;i<are.length;i++)are[i]=sc.nextInt();
		Arrays.sort(are);
		int sa=are[1]-are[0];
		for(int i=0;i<are.length-1;i++){
			int now=are[i+1]-are[i];
			if(now != sa || now == 0){
				System.out.println("NO");
				return;
			}
		}System.out.println("YES");
	}
}
0