No codes, just some ideas.
First, there is a DP way.
let Arr[x][y] means that the sum is X and the maximum added number is less than or equal to y.
What we want is Arr[T][T]
For initial, Arr[x][1] = 1...1 (1<= x <= T), Arr[0][0] = null and Arr[X][0] = error (X != 0)
then Arr[X][Y] = sumWayOf( Arr[X- Y*i][Y-1]) ( 1<=i <= floor(X/Y) )
To save the data. vector<vector<int>> Arr[T+1][T+1];

also, it can be easily changed into a memorized dfs way.