My program is not working please help!

This is the link for the question,
I am new here

#include

using namespace std;

int main()
{
long long int t, n, k;
cin >> t;

while (t--)
{
	cin >> n >> k;
	long long int* arr = new long long int[n];

	for (long long int i = 0; i < n; i++)
		cin >> arr[i];
	long long int days = 0;
	long long int sum = 0;
	for (long long int i = 0; i < n; i++)
	{
		sum += arr[i];
	}

	cout << (sum / k) + 1 << endl;
}

return 0;

}

This is my code, it was working fine with my compiler (Visual Studio)
But here it is showing wrong answer

I was unable to upload the image but it shows that subtask 1 has the wrong answer

It is the wrong approach.
for example for test case:

7 5 
10 5 5 3 2 1 10

your’s would give 8 , but the answer is 6

1 Like

Oh now I get it
thanks man !
Great help

1 Like