can you help me find Chef and Ground problem in practice? [CHEFGR]
I saw the problem in the COMPETE and worked out the problem but I cant find it in practice. It would be a pleasure if someone help me find it so I can check if I did it right.
Here’s my code anyway.
#include <iostream>
#include <string>
using namespace std;
int main()
{
int testCases, column, cubes, sum = 0, largest = 0, test = 0;
cin >> testCases;
for(int x = 1; x <= testCases; x++)
{
cin >> column >> cubes;
int arr[column];
for(int x = 0; x < column; x++)
{
cin >> arr[x];
sum = sum + arr[x];
}
for(int x = 0; x < column; x++)
{
if(largest < arr[x])
largest = arr[x];
}
largest = largest * column;
if(largest - sum == cubes)
cout << "Yes" << endl;
else if(largest - sum != cubes)
{
test = (cubes-(largest - sum));
if(test % column == 0)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
sum = 0;
test = 0;
largest = 0;
}
return 0;
}