link to the question problem : XXOORR Problem - CodeChef
#include <iostream>
using namespace std;
typedef long long ll;
void solve()
{
int n, k;
cin >> n >> k;
ll arr[n];
for (int i = 0; i < n; i++)
{
cin >> arr[i];
}
ll ans = 0;
for (int i = 0; i < 32; i++)
{
int count = 0;
for (int j = 0; j < n; j++)
{
if (arr[j])
{
if (arr[j] & 1)
count++;
arr[j] /= 2;
}
}
ans += (count + k - 1) / k;
}
cout << ans << "\n";
}
int main()
{
int t;
cin >> t;
while (t--)
{
solve();
}
return 0;
}
In this solution , I was not able to understand this formula “(count + k - 1) / k”
Help me please !!