No.1134 Deviation Score Ⅱ
タグ : / 解いたユーザー数 15
作問者 :
WrongAccept
/ テスター :
null
Problem Statement
There are $N$ students in the class NaN-kun is in charge of.
A test was held, and the students' scores, out of a maximum of 100 points, were {$x_1,x_2…x_N$}.
Find the deviation score of student $M$, rounded down by truncating the fractional part. Here, "truncating the fractional part" means "rounding to an integer toward 0". (Added)
The deviation score is calculated as follows.
(1). Find the square of the difference from the average score for everyone.
(2). Find the square root of the average of (1).
(3). Multiply the difference from the average score by 10 and divide by (2). However, if (2) is 0, the deviation score is 50. (Added)
(4). If the score is higher than the average score, add (3) to 50; otherwise, subtract (3) from 50.
Input
$N$ $x_1\ x_2\ x_3...x_N$ $M$
$1≦N≦10^5$
$0≦x_i≦100$
$1≦M≦N$
$N$,$M$,$x_i$ are integers.
Output
Output the deviation score of student $M$ as an integer on one line.
* For example, outputting 65 as 65.0 will result in WA.
Sample
Sample 1
Input
10 50 90 60 60 40 100 40 40 50 70 2
Output
65
Average score: 60
Square root of the average of the squares of the differences from the average score (2): 20
Difference from the average score*10/(2): 30*10/20=15
Since the score is higher than the average: 50+15=65
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。