結果
問題 |
No.21 平均の差
|
ユーザー |
|
提出日時 | 2016-08-17 16:43:41 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 54 ms / 5,000 ms |
コード長 | 686 bytes |
コンパイル時間 | 2,161 ms |
コンパイル使用メモリ | 75,792 KB |
実行使用メモリ | 37,056 KB |
最終ジャッジ日時 | 2024-11-07 18:49:01 |
合計ジャッジ時間 | 3,290 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
import java.lang.*; import java.io.*; import java.util.ArrayList; import java.util.Collections; class Yuki21 { public static void main(String[] args) throws IOException { DataInputStream d; d = new DataInputStream(System.in); String s; s = d.readLine(); int n; n = Integer.parseInt(s); s = d.readLine(); int k; k = Integer.parseInt(s); ArrayList<Integer> al; al = new ArrayList<Integer>(); for(int i=0; i<n; ++i){ s = d.readLine(); int ni; ni = Integer.parseInt(s); al.add(ni); } Collections.sort(al); int a,b,c; a = al.get(n-1); b = al.get(0); c = a-b; System.out.println(c); } }