You are viewing a single comment's thread. Return to all comments →
int t,n,a,b,c,temp,d; scanf("%d",&t); for(int i=0;i<t;i++) { scanf("%d%d%d",&n,&a,&b); if(a>b) { temp=b; b=a; a=b; } d=a*(n-1); printf("%d ",d); for(int j=1;j<n;j++) { c=((a*(n-1-j))+(b*j)); if(c>d) printf("%d ",c); d=c; } printf("\n"); } return 0;
Seems like cookies are disabled on this browser, please enable them to open this website
Manasa and Stones
You are viewing a single comment's thread. Return to all comments →