結果

問題 No.21 平均の差
ユーザー syu
提出日時 2020-08-26 21:57:12
言語 Java
(openjdk 23)
結果
AC  
実行時間 133 ms / 5,000 ms
コード長 495 bytes
コンパイル時間 2,564 ms
コンパイル使用メモリ 83,432 KB
実行使用メモリ 41,652 KB
最終ジャッジ日時 2024-11-07 14:16:56
合計ジャッジ時間 4,213 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int k=sc.nextInt();
        
        
        //これって最大の数字と最小の数字の差を出せばOk?
        int[] numbers=new int[n];
        for(int i=0;i<n;i++){
            numbers[i]=sc.nextInt();
        }
        Arrays.sort(numbers);
        System.out.println(numbers[numbers.length-1]-numbers[0]);
    }
}
0