1215: 错排问题
Memory Limit:128 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:2
Solved:1
Description
n个编号为1到n的同学手里都有一本书,n本书互不相同,现在把这n本书收起来,再重新分发给同学,要求每个同学必须都有书,并且每个同学现在拿到的书必须不同于之前手里的那本书,问有多少种分发方案?
如n=3有两种分发方案:2 3 1和3 1 2。
Input
第一行输入一个正整数n(1<=n<=20)。
Output
输出一个整数表示方案数。
Sample Input Copy
3
Sample Output Copy
2
HINT
1<=n<=20