#P1350. 车的放置
车的放置
Description
There is a grid board as shown below, where denote the lengths of the corresponding sides, i.e., the numbers of cells on those sides:

When , the corresponding board is as follows:

You need to place non-attacking rooks on this board, meaning that among these rooks, no two share the same row and no two share the same column. Find the number of such placements.
Input Format
A single line with five non-negative integers, representing and .
Output Format
Output one line with a single integer, which is the answer .
2 2 2 2 2
38
Hint
Constraints and Notes
- For some testdata, it is guaranteed that .
- For some testdata, it is guaranteed that .
- For of the data, it is guaranteed that , and there is at least one feasible solution.
Translated by ChatGPT 5
京公网安备 11011102002149号