21812_XX'spuzzle

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

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

Pro.ID

21812

Title

XX's puzzle

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 10000/5000 MS (Java/Others)     Memory Limit: 65536/32768 K (Java/Others)
  • 描述

    XX and QQ are good friends. Some few months ago, XX always sat beside QQ and they always talked about some hard programming problems and also sometimes played StarCraft (∩_∩). XX likes playing Protoss while QQ likes playing Terran, and XX is a perfect player and courage QQ to win the others. But now, XX has gone to ZJU to study master, so QQ always thinks of him. XX is a mischievous boy, and he invariably comes up with lots of hard problems to challenge QQ, but fails at the most time. In the recent days, XX finds a problem which he regards as a very puzzling problem. Being surprised by QQ's skill, XX is determined to let you solve this problem and tests whether the problem is enough puzzling, the problem is described:

    It's not hard to see that every triangulation breaks the polygon into n-2 triangles. The triangulation is called k-isosceles, if there are exactly k isosceles triangles among them. Given integer n and k, compute the number of distinct k-isosceles triangulations of a regular polygon with n vertices. Return the result modulo 9397.

    输入

    There are many test cases.

    For every case, there are two nonnegative integer n and k, 3 ≤ n ≤ 50, 0 ≤ kn-2;

    输出

    Description

    XX and QQ are good friends. Some few months ago, XX always sat beside QQ and they always talked about some hard programming problems and also sometimes played StarCraft (∩_∩). XX likes playing Protoss while QQ likes playing Terran, and XX is a perfect player and courage QQ to win the others. But now, XX has gone to ZJU to study master, so QQ always thinks of him. XX is a mischievous boy, and he invariably comes up with lots of hard problems to challenge QQ, but fails at the most time. In the recent days, XX finds a problem which he regards as a very puzzling problem. Being surprised by QQ's skill, XX is determined to let you solve this problem and tests whether the problem is enough puzzling, the problem is described:

    It's not hard to see that every triangulation breaks the polygon into n-2 triangles. The triangulation is called k-isosceles, if there are exactly k isosceles triangles among them. Given integer n and k, compute the number of distinct k-isosceles triangulations of a regular polygon with n vertices. Return the result modulo 9397.

    Input

    There are many test cases.

    For every case, there are two nonnegative integer n and k, 3 ≤ n ≤ 50, 0 ≤ kn-2;

    Output

    For every case, output the result modulo 9397.

    Sample Input

    4 2
    3 0
    5 3

    Sample Output

    2
    0
    5

    Hint

    For the first case, we can have a diagonal between vertices 0 and 2 or between vertices 1 and 3. In both cases, there are 2 isosceles triangles.

    For the second case, the only triangulation of an equilateral triangle contains no diagonals and 1 isosceles triangle (the polygon itself).

    For the third case, a regular pentagon has 5 triangulations.

    Each of them is obtained by connecting one selected vertex with the two others that are not its neighbors, so each triangulation is 3-isosceles.

    Source

    样例输入

    4 2
    3 0
    5 3

    样例输出

    2
    0
    5

    提示

    For the first case, we can have a diagonal between vertices 0 and 2 or between vertices 1 and 3. In both cases, there are 2 isosceles triangles.

    For the second case, the only triangulation of an equilateral triangle contains no diagonals and 1 isosceles triangle (the polygon itself).

    For the third case, a regular pentagon has 5 triangulations.

    Each of them is obtained by connecting one selected vertex with the two others that are not its neighbors, so each triangulation is 3-isosceles.


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部