-->
当前位置:首页 > 题库

PROGRAMMING:Climbing flagpole

Luz5年前 (2021-05-10)题库531
Little C is very naughty since childhood. Naughty children are smart. Xiao C's primary school has a metal flagpole. Every day before doing morning exercises, the children hold a ceremony to raise the national flag. Every time Xiao C sees the national flag slowly rising, he sings the national anthem, salutes and dazes. One day, little c suddenly wants to climb to the top of the flagpole. If he has an idea, he will put it into action. It is known that the flagpole is n meters high, and the crawling speed of small C is x meters per second. Because the flagpole is very slippery, crawling is very difficult, and small C has limited physical strength, so every T seconds, he has to rest for 2 seconds. Also, because the flagpole is slippery, when not crawling, small C will slide down from the flagpole, and the sliding speed is y meters per second.
###Input format:
Multiple sets of test data, each line input 4 integers n x y t.
(1<=n,x,t,y<=1000)
###Output format:
Output the time of small C reaching the top of the pole, accurate to seconds. If small C can't reach the top of the pole, output - 1. Each output occupies one line.
###Input example:
Here is a set of inputs. For example:
```in
5 4 4 2
9 4 4 2
```
###Output example:
The corresponding output is given here. For example:
```out
two
-1
```







answer:If there is no answer, please comment