結果

問題 No.135 とりあえず1次元の問題
ユーザー abc
提出日時 2016-11-08 02:36:58
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 666 bytes
コンパイル時間 2,414 ms
コンパイル使用メモリ 74,256 KB
実行使用メモリ 56,576 KB
最終ジャッジ日時 2024-06-11 07:03:22
合計ジャッジ時間 7,656 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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();
        }

        int first = x[0];
        //int i = 1;
        int min = Integer.MAX_VALUE;

        for (int i = 1; i < n; i++) {
            int second = x[i];

            if (Math.abs(first - second) < min && Math.abs(first - second) != 0) {
                min = Math.abs(first - second);
            }

            first = second;

        }

        System.out.println(min);

    }

}
0