結果
問題 |
No.1134 Deviation Score Ⅱ
|
ユーザー |
|
提出日時 | 2020-08-07 11:45:56 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 108 ms / 2,000 ms |
コード長 | 1,108 bytes |
コンパイル時間 | 118 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 22,228 KB |
最終ジャッジ日時 | 2024-09-22 21:41:26 |
合計ジャッジ時間 | 2,933 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 27 |
ソースコード
import math import sys n = int(input()) #print(n) x = input() x_list = x.split() #print(x_list) x_intlist = [int(s) for s in x_list] #print(x_intlist) m = int(input()) #何人目の数値を参照するか、リストで参照するときはm-1とする #計算式 s_x = sum(x_intlist) #合計点 l_x = len(x_intlist) #リストの長さ avg_x = s_x / l_x #平均点 #print(avg_x) h_list = [] for p in x_intlist: h = (p - avg_x)**2 #全員の平均との差の平方を求める h_list.append(h) #上の計算結果をリスト化 #print(h_list[m-1]) #選択された生徒の計算結果の表示 s_h = sum(h_list) l_h = len(h_list) avg_h = s_h / l_h #全員との平均との差の平方の平均 sqrt_h = math.sqrt(avg_h) #上の計算結果を平方根にした #print(sqrt_h) sa = avg_x - x_intlist[m-1] #print(sa) sa2 = abs(sa) #print(sa2) if sqrt_h == 0: three = 0 else: three = sa2*10 / sqrt_h #print(three) if x_intlist[m-1] > avg_x: last = 50 + three else: last = 50 - three if last > 0: print(math.floor(last)) else: print(math.ceil(last))