結果
| 問題 |
No.406 鴨等間隔の法則
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-08-05 22:35:39 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 615 ms / 2,000 ms |
| コード長 | 510 bytes |
| コンパイル時間 | 1,965 ms |
| コンパイル使用メモリ | 75,284 KB |
| 実行使用メモリ | 62,044 KB |
| 最終ジャッジ日時 | 2024-07-07 11:21:18 |
| 合計ジャッジ時間 | 15,457 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
import java.util.Arrays;
import java.util.Scanner;
public class Main{
public static void main(String[] args){
solver();
}
static void solver(){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
long[] x=new long[n];
for(int i=0;i<n;i++){
x[i]=sc.nextInt();
}
Arrays.sort(x);
long d=x[1]-x[0];
if(d==0){
System.out.println("NO");
return;
}
for(int i=0;i<n-1;i++){
if(x[i+1]-x[i]!=d){
System.out.println("NO");
return;
}
}
System.out.println("YES");
}
}