結果

問題 No.476 正しくない平均
ユーザー @abcde
提出日時 2019-02-13 21:42:13
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 462 bytes
コンパイル時間 1,259 ms
コンパイル使用メモリ 158,876 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-13 11:12:27
合計ジャッジ時間 2,254 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    
    // 1. 入力情報取得.
    int N;
    double A;
    cin >> N >> A;
    LL X = 0LL;
    for(int i = 0; i < N; i++){
        LL x;
        cin >> x;
        X += x;
    }
    
    // 2. 平均値計算.
    double avg = (X + 0.0) / N;
    bool ans = false;
    if(avg == A) ans = true;

    // 3. 後処理.
    cout << (ans ? "YES" : "NO") << endl;
    return 0;
    
}
0