More addition

Jojo, Lili, and Bibi is playing game about addition. Of course, addition is not a big problem for those who understand about how simple the addition is. But, they don’t want to add certain numbers, but they want to count how many combination of different numbers such that if they add all the numbers, they get N.
They just want to find how many combination of (j,l,b) such that j + l + b = N.
Note that, (j,l,b) is considered valid if the value of j,l or b is non-negative.
Format Input
Input consists of one integer T, the number of testcase, and followed by T lines of N, which is N for ith testcase.
Format Output
Output should be expressed in format ”Case #X: Y” - X is number of testcase and Y is one integer indicating the number of valid combination of (j,l,b) such that j+l+b = Ni.
Constraints • 0 ≤ N ≤ 5.000 • 0 ≤ j,l,b ≤ N
Sample Input 1 (standard input)
2
Sample Output 1 (standard output)
6
Explanation
For Sample Test Case 1, The possible combinations for (j,l,n) are : • (0,0,2) • (0,1,1) • (0,2,0) • (1,0,1) • (1,1,0) • (2,0,0) Thus, the number of possible combination for (j,l,n) is 6.
what formula of combination of j+l+b = n?
(N+1)(N+2)/2
thanks!
Topic archived. No new replies allowed.