結果
| 問題 | 
                            No.1134 Deviation Score Ⅱ
                             | 
                    
| ユーザー | 
                             RISE70226821
                         | 
                    
| 提出日時 | 2020-08-03 16:59:14 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 566 ms / 2,000 ms | 
| コード長 | 1,272 bytes | 
| コンパイル時間 | 2,403 ms | 
| コンパイル使用メモリ | 77,944 KB | 
| 実行使用メモリ | 59,552 KB | 
| 最終ジャッジ日時 | 2024-09-13 09:18:49 | 
| 合計ジャッジ時間 | 14,382 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 27 | 
ソースコード
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 = (double)totalX / N;
		//System.out.print("ave = ");
		//System.out.println(ave);
		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);
		//System.out.print("totalDif = ");
		//System.out.println(totalDif);
		//System.out.print("difAve = ");
		//System.out.println(difAve);
		
		// 偏差値算出
		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.print("score = ");
			//System.out.println(score);
			//System.out.print("tmp = ");
			//System.out.println(tmp);
		}
		
		// 出力
		System.out.println(result);
	}
}
            
            
            
        
            
RISE70226821