#P1002. [NOIP 2002 普及组] 过河卒
[NOIP 2002 普及组] 过河卒
Description
On a chessboard, there is a river-crossing pawn at point that needs to reach the target point . The pawn moves according to the rules: it may move either downward or rightward. There is also an opposing knight at point on the board; the knight’s own square and all squares reachable by a single knight move are called the knight’s controlled squares. Therefore, this is called “the knight blocks the river-crossing pawn.”
The board is represented using coordinates: point is at , point is at , and the knight’s position is also given.

You are to compute the number of distinct paths by which the pawn can travel from point to point , assuming the knight’s position is fixed and does not move in response to the pawn’s moves.
Input Format
One line contains four integers, representing the coordinates of point and the coordinates of the knight, in order: , , , .
Output Format
Output a single integer, the total number of valid paths.
6 6 3 3
6
Hint
For of the data, , and the knight’s coordinates satisfy .
[Source]
NOIP 2002 Junior, Problem 4.
Translated by ChatGPT 5
京公网安备 11011102002149号