1 条题解

  • 0
    @ 2025-3-18 7:43:17
    #include<bits/stdc++.h>
    typedef long long ll, LL;
    using namespace std;
    #define pb push_back
    
    void solve() {
    	int n, x;
    	cin >> n >> x;
    	int a;
    	ll sum = 0;
    	for(int i = 0; i < n; i++) {
    		cin >> a;
    		sum += a;
    	}
    	if(double(sum)/n == x) cout << "YES" << endl;
    	else cout << "NO" << endl;
    }
    
    int main() {
    	ios::sync_with_stdio(false);
    	cin.tie(0);
    	cout.tie(0);
    	
    	int t = 1;
    	cin >> t;
        while(t--) {
        	solve();
    	}
    	
    	return 0;
    }
    

    信息

    ID
    1649
    时间
    1000ms
    内存
    256MiB
    难度
    6
    标签
    提交数
    31
    已通过
    13
    上传者