Problem G
State Transfer Matrix
Languages
en
is
Make a program that you can use for state transfer matrix problems in the rest of this module/problem set.
A state transfer matrix
Such a transfer matrix can be viewed as the adjacency matrix
of a (not necessarily simple) directed graph. Then this is
equivalent to asking for the number of directed paths from a
legal starting state to a legal ending state which contains
exactly
Input
The first line of input contains three positive integers
Output
Print the number of ways to start in a legal state, make
Sample Input 1 | Sample Output 1 |
---|---|
2 1000 10 1 1 1 0 1 1 2 0 1 |
89 |