結果

問題 No.406 鴨等間隔の法則
ユーザー FVRChanFVRChan
提出日時 2017-10-05 10:13:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 600 ms / 2,000 ms
コード長 494 bytes
コンパイル時間 1,925 ms
コンパイル使用メモリ 71,544 KB
実行使用メモリ 63,332 KB
最終ジャッジ日時 2023-09-21 18:45:04
合計ジャッジ時間 16,792 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 416 ms
60,508 KB
testcase_01 AC 118 ms
55,756 KB
testcase_02 AC 119 ms
56,176 KB
testcase_03 AC 119 ms
56,196 KB
testcase_04 AC 578 ms
60,744 KB
testcase_05 AC 392 ms
60,540 KB
testcase_06 AC 412 ms
60,560 KB
testcase_07 AC 404 ms
60,604 KB
testcase_08 AC 544 ms
60,516 KB
testcase_09 AC 599 ms
61,152 KB
testcase_10 AC 421 ms
60,708 KB
testcase_11 AC 526 ms
60,300 KB
testcase_12 AC 457 ms
60,424 KB
testcase_13 AC 470 ms
60,904 KB
testcase_14 AC 544 ms
60,912 KB
testcase_15 AC 221 ms
59,200 KB
testcase_16 AC 246 ms
59,660 KB
testcase_17 AC 203 ms
58,956 KB
testcase_18 AC 237 ms
59,476 KB
testcase_19 AC 256 ms
60,532 KB
testcase_20 AC 282 ms
60,284 KB
testcase_21 AC 277 ms
61,088 KB
testcase_22 AC 345 ms
60,252 KB
testcase_23 AC 464 ms
60,488 KB
testcase_24 AC 514 ms
60,696 KB
testcase_25 AC 600 ms
61,416 KB
testcase_26 AC 579 ms
61,808 KB
testcase_27 AC 538 ms
60,728 KB
testcase_28 AC 543 ms
60,684 KB
testcase_29 AC 581 ms
61,480 KB
testcase_30 AC 585 ms
63,332 KB
testcase_31 AC 573 ms
59,532 KB
権限があれば一括ダウンロードができます

ソースコード

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