結果

問題 No.21 平均の差
ユーザー キョウチクキョウチク
提出日時 2022-05-20 20:18:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 545 bytes
コンパイル時間 5,009 ms
コンパイル使用メモリ 74,596 KB
実行使用メモリ 57,640 KB
最終ジャッジ日時 2023-10-20 10:12:51
合計ジャッジ時間 5,851 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
57,416 KB
testcase_01 AC 133 ms
57,456 KB
testcase_02 AC 132 ms
57,440 KB
testcase_03 AC 131 ms
57,388 KB
testcase_04 AC 130 ms
57,640 KB
testcase_05 AC 129 ms
57,320 KB
testcase_06 AC 130 ms
55,528 KB
testcase_07 AC 130 ms
57,476 KB
testcase_08 AC 134 ms
57,420 KB
testcase_09 AC 130 ms
55,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Test12 {
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String[] line;
    line=sc.nextLine().split(" ");
    int n=Integer.parseInt(line[0]);
    line=sc.nextLine().split(" ");
    int k=Integer.parseInt(line[0]);
    int leng=n/k,leng_1=(n+1)/k;
    int[] num_=new int[n];
    for(int i=0;i<n;i++){
      line=sc.nextLine().split(" ");
      num_[i]=Integer.parseInt(line[0]);
    }
    Arrays.sort(num_);
    int tmp=num_[n-1]-num_[0];
    System.out.println(tmp);
  }
}
0