結果

問題 No.476 正しくない平均
ユーザー ふーらくたる
提出日時 2017-01-27 22:21:47
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 1,020 bytes
コンパイル時間 583 ms
コンパイル使用メモリ 67,780 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 09:39:32
合計ジャッジ時間 1,659 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <utility>
#include <cstdio>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
using namespace std;

#define ALL(a) (a).begin(), (a).end()

using ll = long long;
using P = pair<int, int>;

struct State {
    int v, cost;

    State(int v, int cost): v(v), cost(cost) {}

    // 昇順
    bool operator<(const State& s) const {
        return cost < s.cost;
    }
    // 降順
    bool operator>(const State& s) const {
        return cost > s.cost;
    }
};

void dump_vector(vector<int> vec) {
    for (int i = 0; i < vec.size(); i++) {
        cout << vec[i] << (i < vec.size() - 1 ? " " : "\n");
    }
}

int main() {
    int n;
    ll a, sum = 0;

    cin >> n >> a;
    for (int i = 0; i < n; i++) {
        ll x;
        cin >> x;
        sum += x;
    }
    if (sum == a * n) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}
0