結果

問題 No.21 平均の差
ユーザー yagi2
提出日時 2017-04-26 12:21:12
言語 Java
(openjdk 23)
結果
AC  
実行時間 133 ms / 5,000 ms
コード長 747 bytes
コンパイル時間 2,230 ms
コンパイル使用メモリ 80,992 KB
実行使用メモリ 54,188 KB
最終ジャッジ日時 2024-09-13 14:01:45
合計ジャッジ時間 4,222 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder.No21;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = Integer.parseInt(sc.next());
        int K = Integer.parseInt(sc.next());

        List<Integer> n = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            n.add(Integer.parseInt(sc.next()));
        }

        int ans = 0;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                if (ans < Math.abs(n.get(i) - n.get(j))) {
                    ans = Math.abs(n.get(i) - n.get(j));
                }
            }
        }
        System.out.println(ans);
    }
}
0