結果

問題 No.1134 Deviation Score Ⅱ
ユーザー RISE70226821
提出日時 2020-08-03 14:26:05
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 919 bytes
コンパイル時間 4,999 ms
コンパイル使用メモリ 76,876 KB
実行使用メモリ 60,820 KB
最終ジャッジ日時 2024-07-23 17:58:25
合計ジャッジ時間 18,033 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 22 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		// 入力
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] X = new int[N];
		int totalX = 0;
		for(int i = 0; i < N; i++){
			X[i] = sc.nextInt();
			totalX += X[i];
		}
		int M = sc.nextInt();
		
		// 途中計算
		double ave = totalX / N;
		double[] dif = new double[N];
		double totalDif = 0;
		for(int i = 0; i < N; i++){
			dif[i] = (X[i] - ave) * (X[i] - ave);
			totalDif += dif[i];
		}
		double difAve = Math.sqrt(totalDif / N);
		
		// 偏差値算出
		int result = 0;
		if(difAve == 0){
			result = 50;
		}else{
			int score = X[M-1];
			double tmp = (score - ave) * 10 / difAve;
			result = (int)(50 + tmp);
		}
		
		// 出力
		System.out.println(result);
	}

}
0