結果

問題 No.1134 Deviation Score Ⅱ
ユーザー kpinkcatkpinkcat
提出日時 2023-08-27 01:39:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 570 bytes
コンパイル時間 2,942 ms
コンパイル使用メモリ 105,084 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-27 01:39:19
合計ジャッジ時間 3,379 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 WA -
testcase_02 AC 11 ms
4,380 KB
testcase_03 AC 14 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 16 ms
4,380 KB
testcase_06 AC 5 ms
4,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 10 ms
4,380 KB
testcase_12 AC 10 ms
4,376 KB
testcase_13 AC 18 ms
4,380 KB
testcase_14 AC 11 ms
4,380 KB
testcase_15 WA -
testcase_16 AC 5 ms
4,380 KB
testcase_17 AC 11 ms
4,380 KB
testcase_18 AC 12 ms
4,380 KB
testcase_19 AC 15 ms
4,380 KB
testcase_20 WA -
testcase_21 AC 15 ms
4,380 KB
testcase_22 AC 12 ms
4,376 KB
testcase_23 AC 2 ms
4,384 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 WA -
testcase_26 AC 21 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:24:8: 警告: ‘sq’ may be used uninitialized [-Wmaybe-uninitialized]
   24 |     sq /= n;
      |     ~~~^~~~
main.cpp:14:27: 備考: ‘sq’ はここで定義されています
   14 |     double n, m, ave = 0, sq;
      |                           ^~

ソースコード

diff #

#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
using namespace std;


int main()
{
    double n, m, ave = 0, sq;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++){
        cin >> v[i];
        ave += v[i];
    }
    cin >> m;
    ave /= n;
    for (int i = 0; i <n; i++) sq += (ave - v[i])*(ave - v[i]);
    sq /= n;
    sq = pow(sq, 0.5);
    if (sq == 0) cout << 50 << endl;
    else cout << fixed << setprecision(0) << (v[m-1] - ave)*10/sq + 50 << endl;
}
0