➤ Problem Link : CANDY3
👉 Hint : Simple logic using modulus
✅ C++ Solution :
#include<bits/stdc++.h> using namespace std; #define ll long long int int main() { int t; cin>>t; while(t--) { ll n,x; cin>>n; ll rem=0; for(int i=0;i<n;i++) { cin>>x; rem=(rem+x%n)%n; } if(rem==0) cout<<"YES"<<endl; else cout<<"NO"<<endl; } }
Thank you for your patience reading. If you enjoyed this post, I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Whatsapp or Facebook.
😇Happy Learning!!