結果

問題 No.21 平均の差
ユーザー yagi2yagi2
提出日時 2017-04-26 12:21:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 121 ms / 5,000 ms
コード長 747 bytes
コンパイル時間 2,080 ms
コンパイル使用メモリ 72,016 KB
実行使用メモリ 56,100 KB
最終ジャッジ日時 2023-10-11 15:12:05
合計ジャッジ時間 4,069 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,568 KB
testcase_01 AC 119 ms
55,516 KB
testcase_02 AC 121 ms
55,920 KB
testcase_03 AC 121 ms
55,596 KB
testcase_04 AC 120 ms
55,828 KB
testcase_05 AC 120 ms
55,372 KB
testcase_06 AC 121 ms
56,100 KB
testcase_07 AC 120 ms
55,556 KB
testcase_08 AC 120 ms
56,000 KB
testcase_09 AC 120 ms
55,796 KB
権限があれば一括ダウンロードができます

ソースコード

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