I am getting wrong answer in guess the number problem can anyone help me.
Here’s the link for this problem: GUESSNUM Problem - CodeChef
#include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
for(int k=0;k<t;k++)
{
int c=0,i=0;
int a,m,n,d,b[1000000];
scanf("%d %d",&a,&m);
n=m/a;
d=m%a;
if(m%a==0)
{
printf("%d\n",c);
printf("\n");
}
else
{
while(n>=d)
{
if(n%d==0)
{
b[i]=n;
c++;
i++;
}
n=n-1;
d=m-a*n;
}
printf("%d\n",c);
for(int y=c-1;y>=0;y--)
printf("%d ",b[y]);
printf("\n");
}
}
}