# 题目

{% fold 点击显/隐题目 %}

At first day Mister B read v0 pages, but after that he started to speed up. Every day, starting from the second, he read a pages more than on the previous day (at first day he read v0 pages, at second — v0?+?a pages, at third — v0?+?2a pages, and so on). But Mister B is just a human, so he physically wasn't able to read more than v1 pages per day.

Also, to refresh his memory, every day, starting from the second, Mister B had to reread last l pages he read on the previous day. Mister B finished the book when he read the last page for the first time.

Help Mister B to calculate how many days he needed to finish the book.

First and only line contains five space-separated integers: c, v0, v1, a and l (1?≤?c?≤?1000, 0?≤?l?
Print one integer — the number of days Mister B needed to finish the book.
5 5 10 5 4 12 4 12 4 1 15 1 100 0 0
1 3 15
{% endfold %}

# 代码

{% fold 点击显/隐代码 %}```cpp Mister B and Book Reading https://github.com/OhYee/sourcecode/tree/master/ACM 代码备份
//
#define debug
#include
//
/
#include
#include
#include
using namespace std;

int main() {
#ifdef debug
freopen("in.txt", "r", stdin);
int START = clock();
#endif
cin.tie(0);
cin.sync_with_stdio(false);

``````int c, v0, v1, a, l;

while (cin >> c >> v0 >> v1 >> a >> l) {
int ans = 0;
int hr = 0;
while (hr < c) {
if(ans)
hr -= l;
v0 = min(v0, v1);
hr += v0;
ans++;

v0 += a;
}
cout << ans << endl;
}
``````

#ifdef debug
printf("Time:%.3fs.\n", double(clock() - START) / CLOCKS_PER_SEC);
#endif
return 0;
}

`{% endfold %}`