A. Mister B and Book Reading
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Mister B once received a gift: it was a book about aliens, which he started read immediately. This book had c pages.

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.

Input

First and only line contains five space-separated integers: cv0, v1, a and l (1 ≤ c ≤ 1000, 0 ≤ l < v0 ≤ v1 ≤ 1000, 0 ≤ a ≤ 1000)
— the length of the book in pages, the initial reading speed, the maximum reading speed, the acceleration in reading speed and the number of pages for rereading.

Output

Print one integer — the number of days Mister B needed to finish the book.

Examples
input
5 5 10 5 4
output
1
input
12 4 12 4 1
output
3
input
15 1 100 0 0
output
15
Note

In the first sample test the book contains 5 pages, so Mister B read it right at the first day.

In the second sample test at first day Mister B read pages number 1 - 4, at second day — 4 - 11,
at third day — 11 - 12 and finished the book.

In third sample test every day Mister B read 1 page of the book, so he finished in 15 days.

———————————————————————————————————

题目的意思是有人看书 第一天看v0页,每天比前一天多a页但不会超过v1页,每天会往

上一天看过的最后l页,问c页的书几天能看完

思路:模拟,防止到终点看回去可以先处理第一天,后门每天先退后进

Codeforces820A Mister B and Book Reading 2017-06-28 09:38 67人阅读 评论(0) 收藏的更多相关文章

  1. codeforces820B Mister B and Angle in Polygon 2017-06-28 09:42 123人阅读 评论(0) 收藏

    B. Mister B and Angle in Polygon time limit per test 2 seconds memory limit per test 256 megabytes i ...

  2. 2014/11/06 Oracle触发器初步 2014-11-06 09:03 49人阅读 评论(0) 收藏

    触发器我就不多解释了,保证数据的完整性的神器,嗯..也是减少程序员工作托管给数据库操作的好帮手.就不讲一些大道理了.通俗点,我们对数据库的操作,无非就是增 删 改 查. 触发器就是在删,改,增的时候( ...

  3. Codeforces777D Cloud of Hashtags 2017-05-04 18:06 67人阅读 评论(0) 收藏

    D. Cloud of Hashtags time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

  4. POJ3320 Jessica's Reading Problem 2017-05-25 19:55 38人阅读 评论(0) 收藏

    Jessica's Reading Problem Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 12346   Accep ...

  5. NPOI 通用导出数据到Excel 分类: C# Helper 2014-11-04 16:06 246人阅读 评论(0) 收藏

    应用场景: 在项目中,经常遇到将数据库数据导出到Excel,针对这种情况做了个程序封装.工作原理:利用NPOI将SQL语句查询出的DataTable数据导出到Excel,所见即所得. 程序界面:   ...

  6. cloud theory is a failure? 分类: Cloud Computing 2013-12-26 06:52 269人阅读 评论(0) 收藏

    since LTE came out, with thin client cloud computing  and broadband communication clouding 不攻自破了.but ...

  7. A simple problem 分类: 哈希 HDU 2015-08-06 08:06 1人阅读 评论(0) 收藏

    A simple problem Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) To ...

  8. H - Solve this interesting problem 分类: 比赛 2015-07-29 21:06 15人阅读 评论(0) 收藏

    Have you learned something about segment tree? If not, don't worry, I will explain it for you.  Segm ...

  9. {A} + {B} 分类: HDU 2015-07-11 18:06 6人阅读 评论(0) 收藏

    {A} + {B} Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total ...

随机推荐

  1. andorid 配置器组件和提示消息

    .xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android ...

  2. Spring 属性注入(四)属性键值对 - PropertyValue

    Spring 属性注入(四)属性键值对 - PropertyValue Spring 系列目录(https://www.cnblogs.com/binarylei/p/10117436.html) P ...

  3. ApplicationContext(七)Message 源

    ApplicationContext(七)Message 源 本节则是初始化消息资源池,对国际化的支持.暂时先略过. 每天用心记录一点点.内容也许不重要,但习惯很重要!

  4. C++11与Unicode及使用标准库进行UTF-8、UTF-16、UCS2、UCS4/UTF-32编码转换

    zt https://blog.poxiao.me/p/unicode-character-encoding-conversion-in-cpp11/ Unicode Unicode是计算机领域的一项 ...

  5. JS浏览器Session存取数据

    vm.indexdata.indexId = id; vm.indexdata.indexName = name; var tempIndex = JSON.stringify(vm.indexdat ...

  6. 【UI测试】--快捷键组合

  7. MySQL查找SQL耗时瓶颈 SHOW profiles

    http://blog.csdn.net/k_scott/article/details/8804384 1.首先查看是否开启profiling功能 SHOW VARIABLES LIKE '%pro ...

  8. SpringMVC作用域传值几种方式

    一.SpringMVC 作用域传值的几种方式 1  使用原生Servlet 1.1 在 HandlerMethod 参数中添加作用域对象 1.1.1 ServletContext不能在方法参数中获取, ...

  9. 46.UISearchBar的placeholder字体颜色和背景颜色

    1.改变searchbar的searchField属性 UITextField *searchField = [searchbar valueForKey:@"searchField&quo ...

  10. mysql之多表查询和pymysql模块

    一 多表查找方法 1 交叉连接:不使用任何的判断条件,生成笛卡尔积.第一个表的行数乘以第二个表的行数就等于笛卡尔积结果集的行数. mysql> select * from student,cla ...