简单题,
View Code
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
int main()
{
//freopen("D:\\t.txt", "r", stdin);
int t, n;
scanf("%d", &t);
for (int i = 0; i < t; i++)
{
scanf("%d", &n);
int w = 0, x = 1;
for (int j = 1; j <= n; j++)
{
x += j + 1;
w += j * x;
}
printf("%d %d %d\n", i + 1, n, w);
}
return 0;
}