Submit | All submissions | Best solutions | Back to list |
SUMSCALC - Sums to calculate |
Given an integer n, your task is to compute the following sums:
- The sum S of the n first integers (starting from 1)
- The sum Seven of the n first even integers (starting from 2)
- The sum Sodd of the n first odd integers (starting from 1)
- The sum Ssquares of the n first squares of integers (1, 4, 9, ...)
- The sum Scubes of the n first cubes of integers (1, 8, 27, ...)
Input
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows. Each test case is described in a single line containing the integer « n » (1 ≤ n ≤ 104 ).
Output
For each test case, print a single line containing five space-separated integers: S Seven Sodd Ssquares Scubes
Example
Input: 3 4 5 6 Output: 10 20 16 30 100 15 30 25 55 225 21 42 36 91 441
Added by: | mbk_live |
Date: | 2019-01-08 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C-CLANG C C++ 4.3.2 CPP CPP14 CPP14-CLANG C99 JAVA PYTHON PYTHON3 SWIFT |