#P1657. 选书

选书

Description

When school goes on winter break, the informatics olympiad coach has 1,2,3,,x1,2,3,\cdots,x books to distribute to xx trainees. Each person can receive only one book, but each person has two favorite books.

The teacher first asks each person to write down the books they like on a sheet. Then, based on these sheets, the teacher assigns the books. Please write a program to find the total number of possible assignment schemes in which every student is satisfied.

Input Format

Line 11: a number xx.

Lines 22 through 1+x1+x: each line contains two numbers, indicating the indices of the books that aia_i likes.

Output Format

A single number: the total number of schemes total\mathit{total}.

5
1 3
4 5
2 5
1 4
3 5
2

Hint

Constraints

For all testdata, 1x201\le x\le 20.

update 2022/03/07\text{update 2022/03/07}, Ruan Xingzhi

In the original testdata for this problem, the last data point has xx equal to 00, and the expected output is 00. Considering this data is unreasonable, it has been removed. Now, when submitting this problem, you will not encounter data points with x=0x=0.

Translated by ChatGPT 5