409204: GYM103456 G Marbles Pt. I

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

G. Marbles Pt. Itime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Player 101 and player 278 are playing a game to decide who advances to the next round. Due to the massive stakes player 101 decides to rig the game in his favor.

The game goes as follows. There is a start location and a straight-line path of length $$$t$$$ miles to the finish line. Player 101 must take a single red marble from the start line to the finish line before player 278 catches him.

When the whistle blows to start running, player 278 is required to wait $$$d$$$ hours before beginning to chase after player 101. Player 101 runs at $$$a$$$ miles per hour while player 278 runs at $$$b$$$ miles per hour. However, the twist in the game is that player 101 tricks player 278 into believing that there is an additional rule such that whenever you find a blue marble, you must take it back to the start line and wait $$$s$$$ hours before beginning running again.

Player 101 bribes a guard to get some blue marbles and decides to drop a blue marble each time player 278 catches up to him (which means that player 278 must go all the way back to the start line, wait $$$s$$$ hours, and then resume his chase). If player 101 doesn't have a blue marble when player 278 catches up to him then player 101 loses. If player 101 and player 278 both reach the finish line at the same time, player 101 wins and he does not need a blue marble in that case.

Player 101 needs to pay for each blue marble he gets from the guard so he asks you what is the smallest number of blue marbles he needs to buy so that he can get to the finish line (assume he runs the whole time without stopping, dropping the marble takes negligible time) without losing the game.

Input

The single line of input contains $$$5$$$ space separated-integers $$$a, b, t, d, s$$$ where $$$a$$$ is the speed of player 101 in miles per hour, $$$b$$$ is the speed of player player 278 in miles per hour, $$$t$$$ is how many miles away the finish line is, $$$d$$$ is how many hours player 278 must wait before chasing, and $$$s$$$ is how long player 278 must wait at the start line after bringing back a blue marble. ($$$1 \leq a, b \leq 100$$$, $$$1 \leq t \leq 10^{4}$$$, and $$$1 \leq d, s \leq 10$$$)

Output

A single integer representing the minimum number of blue marbles player 101 must buy in order to guarantee him victory.

ExamplesInput
1 2 9 1 1
Output
2
Input
3 10 100 4 2
Output
3
Note

In the first example, player 278 waits for an hour at which point player 101 is $$$1$$$ mile away. Player 278 then catches up at the $$$2$$$-mile mark at which point player 101 drops one blue marble. It will take $$$1$$$ hour for player 278 to get back to the start line and then he must wait for $$$1$$$ more hour at which point player 101 will be $$$4$$$ miles away. Player 278 then catches up to player 101 at the $$$8$$$-mile mark and so player 101 drops another blue marble at which point he then has enough time to get to the finish line without player 278 catching up again which is why he needs $$$2$$$ blue marbles to guarantee a win.

加入题单

上一题 下一题 算法标签: