#P2151. [SDOI2009] HH 去散步
[SDOI2009] HH 去散步
Description
HH has an unchanging habit: he likes to walk one hundred steps after meals. By “one hundred steps,” he means taking a walk, that is, covering a certain distance within a certain time. However, HH also likes variety, so he will not immediately walk back along the road he just took. Since he likes variety, the path he takes each day is not exactly the same. He wants to know how many different ways he can take such a walk.
You are given the school’s map (assume every road has the same length, which is ). Find the number of valid paths of length from a given location to a given location .
Input Format
The first line contains five integers . Here is the number of intersections in the school, is the number of roads, is the distance HH wants to walk, is the starting point, and is the destination.
The next lines each contain a pair , meaning there is a road from intersection to intersection . It is guaranteed that , but there may be multiple roads connecting the same pair of intersections. Intersections are numbered from to . All data on the same line are separated by a single space, and there are no extra spaces at the beginning or end of lines. There are no extra blank lines.
Output Format
Output one line: the answer modulo .
4 5 3 0 0
0 1
0 2
0 3
2 1
3 2
4
Hint
Constraints and Conventions
For of the testdata, , , .
For of the testdata, , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号