CodeKing Vs. Neophyte


2018-05-17 13:00 UTC

CodeKing Vs. Neophyte


2018-05-19 13:00 UTC
The end is near!
Contest is over.
Not yet started.
Contest is starting in -311 days 16:50:33

Time elapsed


Time remaining


Problem F
Sum Kind of Problem

For this problem you will compute various running sums of values for positive integers.


The first line of input contains a single integer $P$, ($1 \le P \le 10\, 000$), which is the number of data sets that follow. Each data set should be processed identically and independently. Each data set consists of a single line of input. It contains the data set number, $K$, followed by an integer $N$, ($1 \le N \le 10\, 000$).


For each data set there is one line of output. The single output line consists of the data set number, $K$, followed by a single space followed by three space separated integers $S_1$, $S_2$ and $S_3$ such that:

  • $S_1$ = The sum of the first $N$ positive integers.

  • $S_2$ = The sum of the first $N$ odd integers.

  • $S_3$ = The sum of the first $N$ even integers.

Sample Input 1 Sample Output 1
1 1
2 10
3 1001
1 1 1 2
2 55 100 110
3 501501 1002001 1003002