結果

問題 No.1134 Deviation Score Ⅱ
ユーザー magmag
提出日時 2020-08-10 22:04:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 1,143 bytes
コンパイル時間 1,806 ms
コンパイル使用メモリ 162,704 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 05:43:22
合計ジャッジ時間 2,555 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 8 ms
5,376 KB
testcase_02 AC 6 ms
5,376 KB
testcase_03 AC 7 ms
5,376 KB
testcase_04 AC 4 ms
5,376 KB
testcase_05 AC 8 ms
5,376 KB
testcase_06 AC 4 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 7 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 6 ms
5,376 KB
testcase_12 AC 6 ms
5,376 KB
testcase_13 AC 9 ms
5,376 KB
testcase_14 AC 6 ms
5,376 KB
testcase_15 AC 4 ms
5,376 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 6 ms
5,376 KB
testcase_18 AC 6 ms
5,376 KB
testcase_19 AC 8 ms
5,376 KB
testcase_20 AC 4 ms
5,376 KB
testcase_21 AC 7 ms
5,376 KB
testcase_22 AC 6 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 3 ms
5,376 KB
testcase_26 AC 10 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll=long long;
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define rep(i, n) rep2(i,0,n)

void out(){cout<<endl;} template<typename Head,typename... Tail> void out(Head&& head,Tail&&... tail){cout<<head<<" ";out(forward<Tail>(tail)...);}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n,m;
  cin>>n;
  int x[n];
  rep(i,n)cin>>x[i];
  cin>>m;
  //平均値
  long double ave=0;
  rep(i,n)ave+=x[i];
  ave/=n;
  //(1).全員の平均点との差の平方を求める
  long double dxave=0,dx;
  rep(i,n){
    dx=x[i]-ave;
    dxave+=dx*dx;
  }
  dxave/=n;
  //(2).(1)の平均の平方根を求める
  long double sq=sqrt(dxave),dx2,a;
  //ただし、(2) が 0 の時は、偏差値を 50 とする。(追記)
  int ans=50,xm;
  if(sq){
    xm=x[m-1];
    dx=xm-ave;
    //(3).平均点との差に10をかけて(2)で割る。
    dx2=dx*10/sq;
    a=floor(dx2+ans);
    //(4).平均点より点数が高かった場合50に(3)を足し、そうでなければ(3)を引く
    if(dx2+ans<0)a=ceil(dx2+ans);
    ans=a;
  }
  //偏差値
  cout<<ans<<endl;
}
0