本站作为LDUOnlineJudge的测试版本进行演示,官方网站请访问http://icpc.ldu.edu.cn
[Hidden]

1332. B. Are We Stopping Again?


Description

Going on a road trip has been an adventure for Dr. Orooji and the programming team. Obviously he has to stop to refuel the car, but he also stops whenever the team members want to eat. Dr. O needs to figure out the number of stops before going on the trip so he is mentally prepared.


The Problem:
Find the total number of stops for Dr. O’s trip, given:
    1. Total miles to be traveled.
    2. How often he stops for gas (in miles).
    3. How often he stops for food (in miles).

Assume that the car’s gas tank is full at the beginning of the trip and the team members are full as well. If the destination happens to be the time to refuel (or eat), do not count it as a stop. Also, if a particular mileage happens to be both refueling time and eating time, count it as one stop and not two stops.
Note that if a particular mileage happens to be refueling time only, the team members won’t eat at that stop. Similarly, if a particular mileage happens to be eating time only, the car is not refueled at that stop.


Input

There is one input line, it provides three integers (each between 1 and 1000, inclusive); these are the three values specified in order above.

Output

Print the number of stops for the trip on a line by itself.

Samples

Input Copy
100 30 40
Output
5

Source

UCF2019 PRACTICE
Problem Information

Time Limit: 1000MS (C/C++,Others×2)
Memory Limit: 128MB (C/C++,Others×2)
Special Judge: No
AC/Submit: 14 / 17
Tags:
Contests involved

1037. UCF 2019 Practice
My history solutions

You didn't submit any solution!
Submit your solution

Login Register