#T490. 【NOIP2002-J4】过河卒
【NOIP2002-J4】过河卒
Description
As shown in the figure, there is a pawn at point A that needs to move to the target point B. The pawn's movement rules: it can move either downward or to the right. At the same time, there is an opponent's horse at a certain point on the chessboard (such as point C in the figure above). The point where the horse is located and all points reachable in one move are called the control points of the opponent's horse. For example, the horse at point C in the figure above can control 9 points (P1, P2 ... P8 and C in the figure). The pawn cannot pass through the control points of the opponent's horse.
The chessboard is represented by coordinates. Point A is (0, 0), and point B is (n, m) (where n and m are integers not exceeding 20 and are input via the keyboard). Similarly, the coordinates of the horse's position must be provided (it is stipulated that C ≠ A and C ≠ B). Now, you are required to calculate the number of paths the pawn can take from point A to point B.
Input Format
A single line with four positive integers, representing the coordinates of point B and the coordinates of the horse.
Output Format
An integer representing the total number of paths.
【Data Range】
For 100% of the data, 1≤n,m≤20, Accepted solution program:0≤horse's coordinates≤20
Source
NOIP2002-J4