10118_TheClocks

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

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

Pro.ID

10118

Title

The Clocks

Title链接

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

AC

43

Submit

322

Ratio

13.35%

时间&空间限制

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

    Consider nine clocks arranged in a 3×3 array thusly:

     |-------|    |-------|    |-------|
     |       |    |       |    |   |   |
     |---O   |    |---O   |    |   O   |
     |       |    |       |    |       |
     |-------|    |-------|    |-------|
     A            B            C

     |-------|    |-------|    |-------|
     |       |    |       |    |       |
     |   O   |    |   O   |    |   O   |
     |   |   |    |   |   |    |   |   |
     |-------|    |-------|    |-------|
     D            E            F

     |-------|    |-------|    |-------|
     |       |    |       |    |       |
     |   O   |    |   O---|    |   O   |
     |   |   |    |       |    |   |   |
     |-------|    |-------|    |-------|
     G            H            I

    The goal is to find a minimal sequence of moves to return all the dials to 12 o'clock. Nine different ways to turn the dials on the clocks are supplied via a table below; each way is called a move. Select for each move a number 1 through 9 which will cause the dials of the affected clocks (see next table) to be turned 90 degrees clockwise.

    Move Affected clocks
    1 ABDE
    2 ABC
    3 BCEF
    4 ADG
    5 BDEFH
    6 CFI
    7 DEGH
    8 GHI
    9 EFHI

    Each number represents a time accoring to following table:

    9 9 12       9 12 12       9 12 12        12 12 12      12 12 12
    6 6 6  5 ->  9  9  9  8->  9  9  9  4 ->  12  9  9  9-> 12 12 12
    6 3 6        6  6  6       9  9  9        12  9  9      12 12 12

    [But this might or might not be the 'correct' answer; see below.]

    输入

    Multiple test cases, first line is an integer T, indecating the number of test cases. Each case has three lines:

    Lines 1-3:  Three lines of three space-separated numbers; each number represents the start time of one clock, 3, 6, 9, or 12. The ordering of the numbers corresponds to the first example above.

    输出

    Description

    Consider nine clocks arranged in a 3×3 array thusly:

     |-------|    |-------|    |-------|
     |       |    |       |    |   |   |
     |---O   |    |---O   |    |   O   |
     |       |    |       |    |       |
     |-------|    |-------|    |-------|
     A            B            C

     |-------|    |-------|    |-------|
     |       |    |       |    |       |
     |   O   |    |   O   |    |   O   |
     |   |   |    |   |   |    |   |   |
     |-------|    |-------|    |-------|
     D            E            F

     |-------|    |-------|    |-------|
     |       |    |       |    |       |
     |   O   |    |   O---|    |   O   |
     |   |   |    |       |    |   |   |
     |-------|    |-------|    |-------|
     G            H            I

    The goal is to find a minimal sequence of moves to return all the dials to 12 o'clock. Nine different ways to turn the dials on the clocks are supplied via a table below; each way is called a move. Select for each move a number 1 through 9 which will cause the dials of the affected clocks (see next table) to be turned 90 degrees clockwise.

    Move Affected clocks
    1 ABDE
    2 ABC
    3 BCEF
    4 ADG
    5 BDEFH
    6 CFI
    7 DEGH
    8 GHI
    9 EFHI

    Each number represents a time accoring to following table:

    9 9 12       9 12 12       9 12 12        12 12 12      12 12 12
    6 6 6  5 ->  9  9  9  8->  9  9  9  4 ->  12  9  9  9-> 12 12 12
    6 3 6        6  6  6       9  9  9        12  9  9      12 12 12

    [But this might or might not be the 'correct' answer; see below.]

    Input

    Multiple test cases, first line is an integer T, indecating the number of test cases. Each case has three lines:

    Lines 1-3:  Three lines of three space-separated numbers; each number represents the start time of one clock, 3, 6, 9, or 12. The ordering of the numbers corresponds to the first example above.

    Output

    For each test case, output :

    A single line that contains a space separated list of the shortest sequence of moves (designated by numbers) which returns all the clocks to 12:00. If there is more than one solution, print the one which gives the lowest number when the moves are concatenated (e.g., 5 2 4 6 < 9 3 1 1).

    Sample Input

    2

    9 9 12
    6 6 6
    6 3 6

    12 9 12
    9 9 9
    12 9 12

    Sample Output

    4 5 8 9
    5

    Source

    样例输入

    2

    9 9 12
    6 6 6
    6 3 6

    12 9 12
    9 9 9
    12 9 12

    样例输出

    4 5 8 9
    5

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部