问题 AR: Gabriel and Caterpillar
内存限制:128 MB
时间限制:1.000 S
评测方式:文本比较
命题人:
提交:284
解决:154
题目描述
9年级的学生加百利在树上高度为 $h_1$ 的地方发现了一只毛毛虫正向着高度为 $h_2$ 的苹果进发。
它在白天每小时上升 $a$ 厘米,晚上每小时下掉 $b$ 厘米。
可以认为白天从10点开始至22点结束,黑夜从22点开始至次日10点结束。
加百利是在下课后看到毛毛虫。加百利每天14点下课,他想知道,几天后他来恰好能看到毛毛虫正在吃苹果?
它在白天每小时上升 $a$ 厘米,晚上每小时下掉 $b$ 厘米。
可以认为白天从10点开始至22点结束,黑夜从22点开始至次日10点结束。
加百利是在下课后看到毛毛虫。加百利每天14点下课,他想知道,几天后他来恰好能看到毛毛虫正在吃苹果?
输入
The first line contains two integers $ h_{1},h_{2} $ ( $ 1<=h_{1};h_{2}<=10^{5} $ ) — the heights of the position of the caterpillar and the apple in centimeters.
The second line contains two integers $ a,b $ ( $ 1<=a,b<=10^{5} $ ) — the distance the caterpillar goes up by day and slips down by night, in centimeters per hour.
The second line contains two integers $ a,b $ ( $ 1<=a,b<=10^{5} $ ) — the distance the caterpillar goes up by day and slips down by night, in centimeters per hour.
输出
Print the only integer $ k $ — the number of days Gabriel should wait to return to the forest and see the caterpillar getting the apple.
If the caterpillar can't get the apple print the only integer $ -1 $ .
If the caterpillar can't get the apple print the only integer $ -1 $ .
样例输入 复制
10 30
2 1
样例输出 复制
1
提示
In the first example at $ 10 $ pm of the first day the caterpillar gets the height $ 26 $ . At $ 10 $ am of the next day it slips down to the height $ 14 $ . And finally at $ 6 $ pm of the same day the caterpillar gets the apple.
Note that in the last example the caterpillar was slipping down under the ground and getting the apple on the next day.
Note that in the last example the caterpillar was slipping down under the ground and getting the apple on the next day.