给大家推荐个靠谱的公众号程序员探索之路,大家一起加油
#include<stdio.h>
int main()
{
int N,n,i=1,sum=0,j,sum1;
scanf("%d",&N);
while(N--)
{
sum=0;
scanf("%d",&n);
printf("%d %d ",i,n);
for(j=1,sum1=1;j<=n;j++)
{
sum1+=j+1;
sum=sum+j*sum1;
}
printf("%d\n",sum);
i++;
}
return 0;
}