AP2 - AP - Complete The Series (Easy)
solution-
#include<stdio.h>
int main()
{ int i,t,j;
long long int n,a,k,b,d,o,sum;
scanf("%d",&t);
for(j=0;j<t;j++)
{
scanf("%lld%lld%lld",&a,&b,&sum);
n=2*sum/(a+b);
d=(b-a)/(n-5);
k=a-2*d;
printf("%lld\n",n);
for(i=1;i<=n;i++)
{
o=k+(i-1)*d;
printf("%lld ",o);
}
printf("\n");
}
return 0;
}
Comments
Post a Comment