21739_Elevator

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

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

Pro.ID

21739

Title

Elevator

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    Edward works as an engineer for Non-trivial Elevators: Engineering, Research and Construction (NEERC). His new task is to design a brand new elevator for a skyscraper with h floors.

    Edward has an idee fixe: he thinks that four buttons are enough to control the movement of the elevator. His last proposal suggests the following four buttons:

    • Move a floors up.

    • Move b floors up.

    • Move c floors up.

    • Return to the first floor.

    Initially, the elevator is on the first floor. A passenger uses the first three buttons to reach the floor she needs. If a passenger tries to move a, b or c floors up and there is no such floor (she attempts to move higher than the h-th floor), the elevator doesn't move.

    To prove his plan worthy, Edward wants to know how many floors are actually accessible from the first floor via his elevator. Help him calculate this number.

    输入

    The first line of the input file contains one integer h — the height of the skyscraper (1 ≤ h 500 000).
    The second line contains three integers a, b and c — the parameters of the buttons (1 a, b, c 100 000).

    输出

    Description

    Edward works as an engineer for Non-trivial Elevators: Engineering, Research and Construction (NEERC). His new task is to design a brand new elevator for a skyscraper with h floors.

    Edward has an idee fixe: he thinks that four buttons are enough to control the movement of the elevator. His last proposal suggests the following four buttons:

    • Move a floors up.

    • Move b floors up.

    • Move c floors up.

    • Return to the first floor.

    Initially, the elevator is on the first floor. A passenger uses the first three buttons to reach the floor she needs. If a passenger tries to move a, b or c floors up and there is no such floor (she attempts to move higher than the h-th floor), the elevator doesn't move.

    To prove his plan worthy, Edward wants to know how many floors are actually accessible from the first floor via his elevator. Help him calculate this number.

    Input
    The first line of the input file contains one integer h — the height of the skyscraper (1 ≤ h 500 000).
    The second line contains three integers a, b and c — the parameters of the buttons (1 a, b, c 100 000).
    Output
    Output one integer number — the number of floors that are reachable from the first floor.
    Sample Input
    15
    4 7 9
    Sample Output
    9
    Source

    样例输入

    15
    4 7 9

    样例输出

    9

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部