Combinatorics Problem: Number of lists $L(N,T)$ of length $N$ and typing time $T$. Consider lists of ordered numbers $(d_1,\dots 
,d_N)$ with $d_j \in \left\{0,1,\dots,9\right\}$. Suppose when typing such a tupel on the keyboard, it costs you some time $t_{d_{j}}$ depending on the element $d_j$ you are typing. The total time to type the complete list is then given by:
$$T = \sum_{j=1}^{N} t_{d_j}$$
My question now is: How can I count the number $L(N,T)$ of lists that have length $N$ and need a total time of $T$ when typing them in the following cases: 
1) Binary Case: $d_j \in \left\{0,1\right\}$
2) General Case: $d_j \in \{0,1,\dots,9\}$
I think this will lead to the problem of counting the number of solutions of the linear equation $T = nt_{d_0} + m t_{d_1}$ with the restriction $N=n+m$, for the binary case for example. But I couldnt figure out how to do this. I would appreciate any help!  

HINT:
I would say that it would be the generalised formula of $(a)$ that is
$$
T=\sum_{i=0}^{9}n_it_{d_i},\qquad where\quad \sum_{j=0}^{9}n_j=N.
$$
So $n_j$ stand for the amount of the digit $j$ you typed.

EDIT:
The solution for the question $(a)$ is the same 
$$
T=\sum_{i=0}^{2}n_it_{d_i},\qquad where\quad \sum_{j=0}^{2}n_j=N.
$$
