Programming contests

ACM ICPC programozó csapatverseny, házi forduló, 2017. október 29.

October 29, 2017, 10:00 AM – October 29, 2017, 3:00 PM

Square

Do you know the game called “La cave aux énigmes”? One of its questions is to find the number of squares contained in a grid square of length l. A grid square of length 4 will look like this:

The total number of squares that can be seen in this image is 30. Your task is to find the total number of squares which can be seen in an image of a grid square of length l.

Input Specification

The first line of the input contains a single integer P, which is the number of data sets that follow. The remaining lines of the input will consist of one integer l per line, which is the grid square length. All integers will be less than 1 000 000 and greater than 0.

Output Specification

For each integer l, you should output the total number of squares which can be seen in an image of a grid square of length l, with one line of output for each line of input. You can assume that no operation overflows a 32-bit integer.

Sample Input

  1. 4
  2. 1
  3. 2
  4. 3
  5. 4
download as text file

Output for Sample Input

  1. 1
  2. 5
  3. 14
  4. 30
download as text file
University of Debrecen; Faculty of Informatics; v. 09/30/2024