Help me in solving EQUALITY problem

My issue

help me in solving Equality problem

Problem Link: Equality Practice Coding Problem - CodeChef

@abhaym96
here , plzz refer my c++ code

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;
	    long long int a[n];
	    long long int sum=0;
	    for(int i=0;i<n;i++)
	    {
	        cin>>a[i];
	        sum+=a[i];
	    }
	    sum=sum/(n-1);
	    for(int i=0;i<n;i++)
	    {
	        cout<<sum-a[i]<<" ";
	    }
	    cout<<endl;
	}
	return 0;
}
1 Like

Thanks sir…

Can I get the explanation please, like the approach to the problem.