10205_AllLatinSquares

2022-5-16 18:16| 发布者: Hocassian| 查看: 79| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-3-89504659476699-Problem List-采集的数据-后羿采集器.html

Pro.ID

10205

Title

All Latin Squares

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=10205

AC

2

Submit

4

Ratio

50.00%

时间&空间限制

  • Time Limit: 1000/500 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    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 × 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 N × N 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.

    输出

    Description

    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 × 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 N × N Latin Squares whose first row is:

    1 2 3 4 5.......N

    Your program should work for any N from 2 to 7.

    Input

    One line containing the integer N.

    Output

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

    Sample Input

    5

    Sample Output

    1344

    Source

    样例输入

    5

    样例输出

    1344

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部