結果

問題 No.21 平均の差
ユーザー kenji_shioya
提出日時 2016-07-07 15:45:57
言語 Java
(openjdk 23)
結果
AC  
実行時間 123 ms / 5,000 ms
コード長 343 bytes
コンパイル時間 3,290 ms
コンパイル使用メモリ 74,504 KB
実行使用メモリ 41,848 KB
最終ジャッジ日時 2024-10-12 23:07:05
合計ジャッジ時間 5,418 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Exercise146{
  public static void main (String[] args){

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int k = sc.nextInt();
    int[] a = new int[n];
    for(int i = 0; i < n; i++){
      a[i] = sc.nextInt();
    }

    Arrays.sort(a);
    System.out.println(a[n - 1] - a[0]);
  }
}
0