I was trying to solve this question. After trying enough i finally read the tutorial. Suppose the minimum number, is a[0]=600. Then we need to calculate how many elements of size 2*600-1=1999 can we form i.e. we simply need to divide each of the a[i] by 1999 and add each of them. But this code is giving wrong results.
#include <bits/stdc++.h>
using namespace std;
#define MULTI int _T; cin >> _T; while(_T--)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
MULTI
{
int n;
cin>>n;
vector<int> a(n);
long long sum = 0;
for(int i=0;i<n;++i)
{
cin>>a[i];
}
for(int i = 0;i<n;++i)
{
sum+=(a[i])/(2*a[0]-1);
}
cout<<sum<<endl;
}
}
I will be thankful for any help!