Woburn Challenge 2001 - Suicidal
On Monday, the number of frosh were reduced in half. To further reduce the number of engineers to a manageable number, the following challenge was devised for the second day. Each of the students would have to take this challenge individually.
Each student would be placed at a vertex of perimeter fence of Waterloo
(oh yeah, some background: to keep UofT's engineering Lady Godiva band
out of Waterloo, a fence was erected surrounding the university. The
fence just happens to be an
- The student can only travel from vertex to vertex (backwards or forwards) along the polygonal fence.
- The student has to make contact with exactly
vertices (the vertex he starts at doesn't count unless he returns to it). The vertices need not be unique. The final vertex has to be the one with the prize. - If the student cannot reach the prize and make contact with exactly
vertices, he fails the test and is kicked out of the university.
Of course, no Waterloo student is satisfied with only
Input Specification
There will be multiple test cases, one after another: a case where
Output Specification
The total number of ways of reaching the destination from the starting
point by following the above rules. The total number of ways will be
less than 0
if there are no solutions.
Sample Input
8 5
1 4
-1 -1
Sample Output
6
Comments