How many ways?
Write a program which identifies the number of combinations of three integers which satisfy the following conditions:
You should select three integers from 1 to n without duplication.
A total sum of the three integers is x.
For example, there are two combinations for n = 5 and x = 9.
1 + 3 + 5 = 9
2 + 3 + 4 = 9