結果

問題 No.1134 Deviation Score Ⅱ
ユーザー yansi819
提出日時 2024-03-25 18:50:51
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 640 bytes
コンパイル時間 4,369 ms
コンパイル使用メモリ 251,456 KB
最終ジャッジ日時 2025-02-20 13:48:03
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;

int N, M;
double x[101010];

int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> x[i];
  cin >> M;
  double S = 0.0;
  for (int i = 0; i < N; i++) S += x[i];
  S /= double(N);
  double T = 0.0;
  for (int i = 0; i < N; i++) T += (S - x[i]) * (S - x[i]);
  T /= double(N);
  T = sqrt(T);
  if (abs(T) < 1e-12) {
    cout << 50 << endl;
    return 0;
  }
  double U = (x[M - 1] - S) * 10 / T;
  //cout << S << ' ' << T << ' ' << U << endl;
  double res = 50 + U;
  cout << ll(res) << endl;
}
0