結果

問題 No.1134 Deviation Score Ⅱ
ユーザー tentententen
提出日時 2020-08-17 22:17:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 617 ms / 2,000 ms
コード長 690 bytes
コンパイル時間 2,881 ms
コンパイル使用メモリ 75,096 KB
実行使用メモリ 48,332 KB
最終ジャッジ日時 2024-04-19 19:12:55
合計ジャッジ時間 15,061 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
41,200 KB
testcase_01 AC 556 ms
48,332 KB
testcase_02 AC 495 ms
47,948 KB
testcase_03 AC 555 ms
48,036 KB
testcase_04 AC 365 ms
47,824 KB
testcase_05 AC 530 ms
48,156 KB
testcase_06 AC 299 ms
47,324 KB
testcase_07 AC 277 ms
47,192 KB
testcase_08 AC 459 ms
48,316 KB
testcase_09 AC 262 ms
46,944 KB
testcase_10 AC 198 ms
42,864 KB
testcase_11 AC 468 ms
48,060 KB
testcase_12 AC 485 ms
48,024 KB
testcase_13 AC 617 ms
48,220 KB
testcase_14 AC 518 ms
47,888 KB
testcase_15 AC 419 ms
47,808 KB
testcase_16 AC 281 ms
47,068 KB
testcase_17 AC 519 ms
47,908 KB
testcase_18 AC 488 ms
48,204 KB
testcase_19 AC 491 ms
48,068 KB
testcase_20 AC 423 ms
47,740 KB
testcase_21 AC 492 ms
48,212 KB
testcase_22 AC 480 ms
48,228 KB
testcase_23 AC 114 ms
41,316 KB
testcase_24 AC 122 ms
41,156 KB
testcase_25 AC 237 ms
46,280 KB
testcase_26 AC 482 ms
47,952 KB
testcase_27 AC 122 ms
41,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		double sum = 0;
		HashSet<Integer> set = new HashSet<>();
		for (int i = 0; i < n; i++) {
		    arr[i] = sc.nextInt();
		    sum += arr[i];
		    set.add(arr[i]);
		}
		if (set.size() == 1) {
		    System.out.println(50);
		    return;
		}
		double mean = sum / n;
		double ssum = 0;
		for (int i = 0; i < n; i++) {
		    ssum += (arr[i] - mean) * (arr[i] - mean);
		}
		double sd = Math.sqrt(ssum / n);
		int m = sc.nextInt() - 1;
		int ans = (int)((arr[m] - mean) * 10 / sd + 50);
		System.out.println(ans);
	}
}
0