用N个四边方形最多可以把平面分成几个区域?
Input
第一行输入一个整数T,表示数据组数(1<=T<=10000); 第二行输入一个正整数n(1<=n<=1000);
Output
对于每组数据,请输出结果。
Input示例
2 1 2
Output示例
2 10
#include <iostream>
#include <math.h>
#include <string.h>
using namespace std;
int t, n;
int main()
{
cin >> t;
for (int i = 0; i < t; i++)
{
cin >> n;
int result = 4 * n *(n - 1) + 2;
cout << result << endl;
}
return 0;
}