結果

問題 No.1134 Deviation Score Ⅱ
ユーザー umezoumezo
提出日時 2020-07-29 06:41:20
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 542 bytes
コンパイル時間 2,018 ms
コンパイル使用メモリ 194,316 KB
最終ジャッジ日時 2025-01-12 07:29:16
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main(){
  int n,m;
  cin>>n;
  
  vector<double> A(n);
  rep(i,n) cin>>A[i];
  cin>>m;
  m--;
  
  double s,e,a=0.0,b=0.0;
  rep(i,n) a+=A[i];
  e=a/n;
  rep(i,n) b+=(A[i]-e)*(A[i]-e);
  if(b==0){
    cout<<50<<endl;
    return 0;
  }
  s=sqrt(b/n);
  
  double c=50+(A[m]-e)*10/s;
  int ans;
  if(c>=0) ans=floor(c)+0.5;
  else ans=ceil(c)-0.5;
  cout<<ans<<endl;
  
  return 0;
}
0