Codeforces Round #794 (Div. 2) 1686A. Everything Everywhere All But One Solution
Problem Link: https://codeforces.com/contest/1686/problem/A
Solution in C++:
///La ilaha illellahu muhammadur rasulullah
///******Bismillahir-Rahmanir-Rahim******///
///Abul Hasnat Tonmoy
///Department of CSE,23rd batch
///Islamic University,Bangladesh
///**********ALLAH IS ALMIGHTY************///
#include <bits/stdc++.h>
using namespace std;
int vis[109],a[109];
int main()
{
int n,x,t,i,j,cn,s;
cin>>t;
while(t--)
{
s=0;
cin>>n;
memset(vis,0,sizeof(vis));
for(i=0; i<n; i++)
{
cin>>a[i];
s+=a[i];
vis[a[i]]=1;
}
if(s%n==0&&vis[s/n]==1)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
}
No comments