http://acm.hdu.edu.cn/showproblem.php?pid=2050
Time limit:2000/1000 MS (java/others)
Memory limit:65536/32768 K (java/others)
Problem Description
We have seen a lot of straight line split plane problem, today's topic slightly changed, we are asking for the maximum number of n-line split plane. For example, a polyline can divide the plane into two parts, and the two polylines can divide the plane into 7 parts, as shown below.
Input
The first line of input data is an integer c that represents the number of test instances, then the C row data, each containing an integer n (0<n<=10000), representing the number of polylines.
Output
For each test instance, output the maximum number of partitions for the plane, and the output of each instance occupies one row.
Sample Input
212
Sample Output
27
Refer to "Specific mathematics":
This article URL address: http://www.bianceng.cn/Programming/sjjg/201410/45443.htm
Complete code:
/*0ms,208kb*/
#include <cstdio>
int main ()
{
int t, N;
scanf ("%d", &t);
while (t--)
{
scanf ("%d", &n);
printf ("%d\n", N * ((n << 1)-1) + 1);
return 0;
}