Help in chef and easy queries

#include
using namespace std;

int main()
{
long long int t;
cin>>t;
while(t–)
{
long long int n,k;
cin>>n>>k;
long long int c=0,cnt=0,i,a;
for(i=0;i<n;i++)
{
cin>>a;
c=c+a-k;
cnt++;
}
if(c<k)
cout<<cnt<<"\n";
else if(c==k)
cout<<cnt+1<<"\n";
else
{
long long int p=c/k;
if((p*k)<=©)
cout<<cnt+(c/k)+1<<"\n";
}
}
// your code goes here
return 0;
}

can you pls say what is wrong in this code? I am getting only 80% of the score.

Input:
1
5 5
7 5 1 3 2

Expected outout : 3
Your code’s output : 5

Solution: For each query you have to check, whether the chef will free or not on that particular day.

You can check my solution for reference :
https://www.codechef.com/viewsolution/38903682

Hope this solves your doubt!!!

1 Like

Thanks, it solved.