21729_QUEENKINGDOM

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

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

Pro.ID

21729

Title

QUEEN KINGDOM

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    A game designer wants to build a modified chess board of size n by n. At certain squares there will be placed pillars that prevent placement of pieces and also prevent attacks across them.

    Before shipping the specifications to a manufacturer, the designer wants to know what is the maximum number of non-attacking queens that can be placed on each of his designs. Recall that queens can attack vertically, horizontally and diagonally as far as possible until the end of board (or, in our case, until a pillar is reached). Also of interest is how many different ways this maximum number can be achieved.

    输入

    Input consists of scenarios. Each scenario starts with an integer n (n <= 10). Input ends when n = 0. The next n lines, each containing n characters represent the rows of the chess board. Here, a '0' represents and open square and a '1' represents a pillar.

    输出

    Description

    A game designer wants to build a modified chess board of size n by n. At certain squares there will be placed pillars that prevent placement of pieces and also prevent attacks across them.

    Before shipping the specifications to a manufacturer, the designer wants to know what is the maximum number of non-attacking queens that can be placed on each of his designs. Recall that queens can attack vertically, horizontally and diagonally as far as possible until the end of board (or, in our case, until a pillar is reached). Also of interest is how many different ways this maximum number can be achieved.

    Input
    Input consists of scenarios. Each scenario starts with an integer n (n <= 10). Input ends when n = 0. The next n lines, each containing n characters represent the rows of the chess board. Here, a '0' represents and open square and a '1' represents a pillar.
    Output
    For each case output the maximum number queens that can be placed, followed by the number of different ways possible (separated by a single space).
    Sample Input
    3
    010
    111
    000
    6
    000000
    000000
    000000
    000000
    000000
    000000
    6
    000010
    001110
    111011
    010110
    011010
    010010
    0
    Sample Output
    3 3
    6 4
    7 270
    Source

    样例输入

    3
    010
    111
    000
    6
    000000
    000000
    000000
    000000
    000000
    000000
    6
    000010
    001110
    111011
    010110
    011010
    010010
    0

    样例输出

    3 3
    6 4
    7 270

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部