EVENEGG - Fuad the wild scientist
Fuad is a wild scientist who lives beside a river in a large cottage alone. One day, while doing his job he found a beautiful and shinning looking egg in a bush. He liked it very much and bought it with him in his house. After 2 days, a dragon poped up from the egg. He was surprised and afraid. But, the dragon was so cute that he decided to keep it with him at his house.
Within few days, he came to know that dragons eat much and grow very rapidly. Every day he used to take a walk with the dragon and come back home before evening.The height of his door is only 7 feet. He figured out that if the dragon grows in that rate, one day the dragon will fail to enter into the house through door.
So, he became very worried and ask for help to only neighbour who is you! He ask you what will be the minimum height of the door at Nth day so that the dragon can enter. You have to help him by telling the minimum height of the door on Nth day.
Fuad will make the door heigher by using colomns of X feet.
Input
The inputs will be initial height of the dragon, (H, 0<H<750) and the Day, (0<n<1,000) on which he wants to know the height of the door, daily growth of the dragon,(G, 0<G<950) and the height of colomns, (X, 0<X< 2,000) using which he will make door. All units are in feet.
Output
One integet, The height of the door at Nth day.
Example
Input:
10 2 4 1
16 5 7 10
5 1 1 4 Output:
19
57
7
Added by: | Ruhul |
Date: | 2019-08-05 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C CPP CPP14 JAVA PYTHON3 |