URI Online Judge | 2218

The Fearful Evil-Son

Por Joel Uchoa, IFCE BR Brazil

Timelimit: 1

So so far away there is a pacific kingdom called Lá-Ara. Lá-Ara leader, the king Naldo, a great pokemon master, is in trouble. A rare mathematician pokemon called Evil-Son invades his territory and it threatened to destroy everything if nobody answer the challenge described as follow.

A set of lines in the pane is said to be in general position if no two lines are parallel and no three lines intersect at a common point. Inside the rectangle of figure (A) we have a set of lines in general position, in other hand, inside the rectangle of figure (B) we have represented a set of lines that isn't in general position.

The challenge consists in compute the number of regions in the plane created by a set of N lines in general position. The king Naldo needs your mathematics and programming skills to save the Lá-Ara kingdom of evil Evil-Son.


The input consists of many instances of the problem. The first line contains just an integer T that represents the number of instances.

Each instance consists of one line thats has the number N representing the number of lines in the set.


For each instance in the input, prints a line with the number of regions created in the plane by the lines in the set.

Input Sample Output Sample