結果

問題 No.21 平均の差
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-04-03 05:23:32
言語 Java
(openjdk 23)
結果
AC  
実行時間 138 ms / 5,000 ms
コード長 823 bytes
コンパイル時間 3,363 ms
コンパイル使用メモリ 75,448 KB
実行使用メモリ 54,456 KB
最終ジャッジ日時 2024-07-04 01:34:27
合計ジャッジ時間 5,333 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

//No.21 平均の差

import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

public class No21 {
    
    static final Scanner sc = new Scanner(System.in);
    static final PrintWriter out = new PrintWriter(System.out,false);

    static void solve() {
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] a = new int[n];
        for (int i=0; i<n; i++) a[i] = sc.nextInt();
        sort(a);
        out.println(a[n-1]-a[0]);
    }

    public static void main(String[] args) {
        long start = System.currentTimeMillis();

        solve();
        out.flush();

        long end = System.currentTimeMillis();
        //trace(end-start + "ms");
        sc.close();
    }

    static void trace(Object... o) { System.out.println(deepToString(o));}
}
0