結果

問題 No.1134 Deviation Score Ⅱ
ユーザー 29da164
提出日時 2020-07-30 14:20:42
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 774 bytes
コンパイル時間 717 ms
コンパイル使用メモリ 74,680 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-04 00:38:25
合計ジャッジ時間 2,616 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 25 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
#include <iomanip>


int main(void){
  using namespace std;
  int n=0, m=0,x[100000];
  double ave=0.0,var=0.0,st=0.0,ans=0.0;

  cin >> n;
  for(int i=0;i<n;i++){
    cin >> x[i];
    ave += (double)x[i];
  }
  cin >> m;

  ave = ave/(double)n;
  for(int i=0;i<n;i++) var += ((double)x[i]-ave)*((double)x[i]-ave);
  st=sqrt(var/n);  
  if(x[m-1] >= ave) ans = 50 + (x[m-1]-ave)*10.0/st;
  else ans = 50 + (x[m-1]-ave)*10.0/st;
  /*
  cout << "ave " << ave << endl;
  cout << "var " << var << endl;
  cout << "n " <<  n << endl;
  cout << "st " <<  st << endl;
  cout << "x[m-1] " <<  x[m-1] <<endl;
  cout << "ans " <<  ans <<endl;
  */
  if(st==0) ans=50;
  cout << fixed << setprecision(0) << floor(ans) << endl;
  
  return 0;    

}
0