結果

問題 No.1134 Deviation Score Ⅱ
ユーザー RISE70226821RISE70226821
提出日時 2020-08-03 16:59:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 494 ms / 2,000 ms
コード長 1,272 bytes
コンパイル時間 2,143 ms
コンパイル使用メモリ 73,728 KB
実行使用メモリ 60,880 KB
最終ジャッジ日時 2023-10-11 10:11:18
合計ジャッジ時間 12,856 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,812 KB
testcase_01 AC 449 ms
60,500 KB
testcase_02 AC 419 ms
60,580 KB
testcase_03 AC 455 ms
60,488 KB
testcase_04 AC 318 ms
60,492 KB
testcase_05 AC 438 ms
58,340 KB
testcase_06 AC 290 ms
60,184 KB
testcase_07 AC 274 ms
60,280 KB
testcase_08 AC 411 ms
60,136 KB
testcase_09 AC 254 ms
59,932 KB
testcase_10 AC 184 ms
58,036 KB
testcase_11 AC 387 ms
60,880 KB
testcase_12 AC 381 ms
60,380 KB
testcase_13 AC 465 ms
60,620 KB
testcase_14 AC 420 ms
60,264 KB
testcase_15 AC 363 ms
60,620 KB
testcase_16 AC 268 ms
60,592 KB
testcase_17 AC 413 ms
60,464 KB
testcase_18 AC 394 ms
60,280 KB
testcase_19 AC 430 ms
60,572 KB
testcase_20 AC 374 ms
60,556 KB
testcase_21 AC 433 ms
60,748 KB
testcase_22 AC 436 ms
58,544 KB
testcase_23 AC 119 ms
54,588 KB
testcase_24 AC 120 ms
56,088 KB
testcase_25 AC 234 ms
59,156 KB
testcase_26 AC 494 ms
60,444 KB
testcase_27 AC 120 ms
56,264 KB
権限があれば一括ダウンロードができます

ソースコード

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 = (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);
	}

}
0