結果
問題 | No.21 平均の差 |
ユーザー | skyline |
提出日時 | 2020-02-02 16:01:40 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 137 ms / 5,000 ms |
コード長 | 837 bytes |
コンパイル時間 | 2,246 ms |
コンパイル使用メモリ | 74,468 KB |
実行使用メモリ | 57,796 KB |
最終ジャッジ日時 | 2023-10-19 01:12:59 |
合計ジャッジ時間 | 4,302 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 137 ms
57,432 KB |
testcase_01 | AC | 135 ms
57,496 KB |
testcase_02 | AC | 137 ms
57,452 KB |
testcase_03 | AC | 137 ms
57,164 KB |
testcase_04 | AC | 136 ms
57,184 KB |
testcase_05 | AC | 137 ms
57,464 KB |
testcase_06 | AC | 135 ms
57,408 KB |
testcase_07 | AC | 132 ms
57,252 KB |
testcase_08 | AC | 136 ms
57,796 KB |
testcase_09 | AC | 134 ms
57,216 KB |
ソースコード
import java.util.Scanner; class Main { public static void main(String[] args) { No0021 no = new No0021(); System.out.println(no.result()); } } class No0021 { private int n; private int k; private String result; public No0021() { Scanner sc = new Scanner(System.in); this.n = sc.nextInt(); this.k = sc.nextInt(); int min = sc.nextInt(); int max = min; for (int i = 1; i < this.n; i++) { int val = sc.nextInt(); if (val < min) { min = val; } else if (max < val) { max = val; } } int sub = max - min; this.result = String.valueOf(sub); } public String result() { return this.result; } }