21689_Cube

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

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

Pro.ID

21689

Title

Cube

Title链接

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

AC

1

Submit

5

Ratio

20.00%

时间&空间限制

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

    Klins has a dramatic toy made of 27 blocks. The toy is illustrated in picture 1 below:

    The toy is made of 17 groups. Each group is composed of 3 or 2 blocks. Each junction between two consecutive groups can rotate 360 degrees. So if Klins is smart enough, he can use the toy to form a 3*3*3 cube (See picture 3).

    In picture 1 above, the first group has 3 blocks, the second group has 2 blocks, and the third has 3 ones, and so on. As the blocks in each group are connected by a bungee, they can never move out of the group whatever possible rotation is performed (See picture 2).

    But not all kinds of such toys that are made up of 27 blocks are possible to form a cube. Klins wants to know whether the given toy can form a cube or not.

    输入

    The input contains multiple cases. The first line of input is the number of test cases ( ≤ 1500 ). For each case, there are 17 integers in a line, each of which is either 3 or 2, denoting the number of blocks in each group. These numbers are given in consecutive order, i.e. any two consecutive groups are assumed to be connected with each other.

    输出

    Description

    Klins has a dramatic toy made of 27 blocks. The toy is illustrated in picture 1 below:

    The toy is made of 17 groups. Each group is composed of 3 or 2 blocks. Each junction between two consecutive groups can rotate 360 degrees. So if Klins is smart enough, he can use the toy to form a 3*3*3 cube (See picture 3).

    In picture 1 above, the first group has 3 blocks, the second group has 2 blocks, and the third has 3 ones, and so on. As the blocks in each group are connected by a bungee, they can never move out of the group whatever possible rotation is performed (See picture 2).

    But not all kinds of such toys that are made up of 27 blocks are possible to form a cube. Klins wants to know whether the given toy can form a cube or not.

    Input

    The input contains multiple cases. The first line of input is the number of test cases ( ≤ 1500 ). For each case, there are 17 integers in a line, each of which is either 3 or 2, denoting the number of blocks in each group. These numbers are given in consecutive order, i.e. any two consecutive groups are assumed to be connected with each other.

    Output

    For each test case, print one line of "yes" if a cube of 3*3*3 can be formed using the given toy, otherwise print "no".

    Sample Input

    2
    3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3
    3 3 3 3 2 2 2 3 3 2 2 3 2 3 2 2 3

    Sample Output

    yes
    yes

    Source

    样例输入

    2
    3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3
    3 3 3 3 2 2 2 3 3 2 2 3 2 3 2 2 3

    样例输出

    yes
    yes

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部