結果

問題 No.476 正しくない平均
ユーザー alchemin
提出日時 2019-09-17 10:52:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 436 bytes
コンパイル時間 1,619 ms
コンパイル使用メモリ 168,588 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-07 06:50:52
合計ジャッジ時間 2,094 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
    double n, a;
    vector<double> v;
    
    cin >> n >> a;
    
    int tmp;
    for (int i = 0; i < n; i++) {
        cin >> tmp;
        v.push_back(tmp);
    }
    
    double sum = accumulate(v.begin(), v.end(), 0);
    double avg = sum / n;
    
    if (avg == a) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    
    return 0;
}
0