Logo HelloWorld信息学奥赛题库

少儿编程

时间限制:1 s 空间限制:256 MB

#13055. All Latin Squares

Statistics

题目描述

A square arrangement of numbers

1 2 3 4 5

2 1 4 5 3

3 4 5 1 2

4 5 2 3 1

5 3 1 2 4

is a 5 x 5 Latin Square because each whole number from 1 to 5 appears once and only once in each row and column. Write a program that will compute the number of NxN Latin Squares whose first row is:

1 2 3 4 5.......N Your program should work for any N from 2 to 7.

输入格式

One line containing the integer N.

输出格式

A single integer telling the number of latin squares whose first row is 1 2 3 . . . N.

样例数据

input

5

output

1344