結果

問題 No.406 鴨等間隔の法則
ユーザー takeya_okinotakeya_okino
提出日時 2017-06-19 20:27:42
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 446 bytes
コンパイル時間 2,050 ms
コンパイル使用メモリ 74,432 KB
実行使用メモリ 48,852 KB
最終ジャッジ日時 2024-04-25 01:09:18
合計ジャッジ時間 17,993 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 476 ms
48,224 KB
testcase_01 AC 125 ms
41,004 KB
testcase_02 AC 109 ms
40,144 KB
testcase_03 WA -
testcase_04 AC 672 ms
48,572 KB
testcase_05 AC 458 ms
48,096 KB
testcase_06 AC 484 ms
48,108 KB
testcase_07 AC 472 ms
48,316 KB
testcase_08 AC 618 ms
48,508 KB
testcase_09 AC 670 ms
48,796 KB
testcase_10 AC 465 ms
48,192 KB
testcase_11 AC 610 ms
48,380 KB
testcase_12 AC 456 ms
48,008 KB
testcase_13 AC 554 ms
48,132 KB
testcase_14 AC 633 ms
48,524 KB
testcase_15 WA -
testcase_16 AC 247 ms
46,420 KB
testcase_17 AC 208 ms
44,724 KB
testcase_18 AC 243 ms
45,492 KB
testcase_19 AC 264 ms
46,852 KB
testcase_20 AC 284 ms
47,804 KB
testcase_21 AC 287 ms
48,012 KB
testcase_22 AC 350 ms
47,756 KB
testcase_23 AC 524 ms
48,460 KB
testcase_24 AC 498 ms
47,104 KB
testcase_25 AC 665 ms
48,424 KB
testcase_26 AC 604 ms
48,676 KB
testcase_27 WA -
testcase_28 AC 547 ms
48,464 KB
testcase_29 AC 589 ms
48,548 KB
testcase_30 AC 593 ms
48,852 KB
testcase_31 AC 685 ms
48,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] x = new int[N];
    for(int i = 0; i < N; i++) {
      x[i] = sc.nextInt();
    }
    Arrays.sort(x);
    String ans = "YES";
    for(int i = 2; i < N; i++) {
      if(x[i] - x[i - 1] != x[1] - x[0]) {
        ans = "NO";
        break;
      }
    }
    System.out.println(ans);
  }
}
0