結果

問題 No.1134 Deviation Score Ⅱ
ユーザー 平松奏哉平松奏哉
提出日時 2020-08-07 11:45:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 1,108 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 11,800 KB
実行使用メモリ 22,920 KB
最終ジャッジ日時 2023-10-24 04:45:25
合計ジャッジ時間 3,006 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,268 KB
testcase_01 AC 86 ms
20,424 KB
testcase_02 AC 67 ms
17,224 KB
testcase_03 AC 75 ms
18,936 KB
testcase_04 AC 50 ms
14,256 KB
testcase_05 AC 84 ms
20,392 KB
testcase_06 AC 43 ms
12,752 KB
testcase_07 AC 39 ms
12,296 KB
testcase_08 AC 74 ms
18,796 KB
testcase_09 AC 37 ms
11,728 KB
testcase_10 AC 29 ms
10,460 KB
testcase_11 AC 66 ms
16,924 KB
testcase_12 AC 64 ms
16,816 KB
testcase_13 AC 88 ms
21,572 KB
testcase_14 AC 66 ms
16,984 KB
testcase_15 AC 53 ms
15,028 KB
testcase_16 AC 40 ms
12,388 KB
testcase_17 AC 64 ms
16,816 KB
testcase_18 AC 67 ms
17,280 KB
testcase_19 AC 78 ms
19,560 KB
testcase_20 AC 55 ms
15,128 KB
testcase_21 AC 76 ms
20,096 KB
testcase_22 AC 66 ms
14,396 KB
testcase_23 AC 28 ms
10,216 KB
testcase_24 AC 28 ms
10,216 KB
testcase_25 AC 35 ms
11,508 KB
testcase_26 AC 90 ms
22,920 KB
testcase_27 AC 28 ms
10,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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))
0