10160_SpinningWheels

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

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

Pro.ID

10160

Title

Spinning Wheels

Title链接

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

AC

13

Submit

45

Ratio

28.89%

时间&空间限制

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

    Each of five opaque spinning wheels has one or more wedges cut out of its edges. These wedges must be aligned quickly and correctly. Each wheel also has an alignment mark (at 0 degrees) so that the wheels can all be started in a known position. Wheels rotate in the 'plus degrees' direction, so that shortly after they start, they pass through 1 degree, 2 degrees, etc. (though probably not at the same time).

    This is an integer problem. Wheels are never actually at 1.5 degrees or 23.51234123 degrees. For example, the wheels are considered to move instantaneously from 20 to 25 degrees during a single second or even from 30 to 40 degrees if the wheel is spinning quickly.

    All angles in this problem are presumed to be integers in the range 0 ≤ angle ≤ 359. The angle of 0 degrees follows the angle of 359 degrees. Each wheel rotates at a certain integer number of degrees per second, 1 ≤ speed ≤ 180.

    Wedges for each wheel are specified by an integer start angle and integer angle size (or 'extent'), both specified in degrees. Wedges in the test data will be separated by at least one degree. The 'extent' also includes the original "degree" of the wedge, so '0 180' means degrees 0..180 inclusive --- one more than most would imagine.

    At the start, which is time 0, all the wheels' alignment marks line up. Your program must determine the earliest time (integer seconds) at or after the start that some wedge on each wheel will align with the wedges on the other wheel so that a light beam can pass through openings on all five wedges. The wedges can align at any part of the rotation.

    输入

    Multiple test cases. For each of five input lines describes a wheel.

    The first integer on an input line is the wheel's rotation speed. The next integer is the number of wedges, 1 ≤ W ≤ 5. The next W pairs of integers tell each wedge's start angle and extent.

    输出

    Description

    Each of five opaque spinning wheels has one or more wedges cut out of its edges. These wedges must be aligned quickly and correctly. Each wheel also has an alignment mark (at 0 degrees) so that the wheels can all be started in a known position. Wheels rotate in the 'plus degrees' direction, so that shortly after they start, they pass through 1 degree, 2 degrees, etc. (though probably not at the same time).

    This is an integer problem. Wheels are never actually at 1.5 degrees or 23.51234123 degrees. For example, the wheels are considered to move instantaneously from 20 to 25 degrees during a single second or even from 30 to 40 degrees if the wheel is spinning quickly.

    All angles in this problem are presumed to be integers in the range 0 ≤ angle ≤ 359. The angle of 0 degrees follows the angle of 359 degrees. Each wheel rotates at a certain integer number of degrees per second, 1 ≤ speed ≤ 180.

    Wedges for each wheel are specified by an integer start angle and integer angle size (or 'extent'), both specified in degrees. Wedges in the test data will be separated by at least one degree. The 'extent' also includes the original "degree" of the wedge, so '0 180' means degrees 0..180 inclusive --- one more than most would imagine.

    At the start, which is time 0, all the wheels' alignment marks line up. Your program must determine the earliest time (integer seconds) at or after the start that some wedge on each wheel will align with the wedges on the other wheel so that a light beam can pass through openings on all five wedges. The wedges can align at any part of the rotation.

    Input

    Multiple test cases. For each of five input lines describes a wheel.

    The first integer on an input line is the wheel's rotation speed. The next integer is the number of wedges, 1 ≤ W ≤ 5. The next W pairs of integers tell each wedge's start angle and extent.

    Output

    For each test case, output a single line with a single integer that is the first time the wedges align so a light beam can pass through them. Print 'none' (lower case, no quotes) if the wedges will never align properly.

    Sample Input

    30 1 0 120
    50 1 150 90
    60 1 60 90
    70 1 180 180
    90 1 180 60

    30 1 350 350
    180 1 10 100
    35 1 67 23
    31 1 30 4
    32 1 50 7

    Sample Output

    9
    none

    Source

    样例输入

    30 1 0 120
    50 1 150 90
    60 1 60 90
    70 1 180 180
    90 1 180 60

    30 1 350 350
    180 1 10 100
    35 1 67 23
    31 1 30 4
    32 1 50 7

    样例输出

    9
    none

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部