Codeforces820A Mister B and Book Reading 2017-06-28 09:38 67人阅读 评论(0) 收藏
2 seconds
256 megabytes
standard input
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.
First and only line contains five space-separated integers: c, v0, 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.
Print one integer — the number of days Mister B needed to finish the book.
5 5 10 5 4
1
12 4 12 4 1
3
15 1 100 0 0
15
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) 收藏的更多相关文章
- 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 ...
- 2014/11/06 Oracle触发器初步 2014-11-06 09:03 49人阅读 评论(0) 收藏
触发器我就不多解释了,保证数据的完整性的神器,嗯..也是减少程序员工作托管给数据库操作的好帮手.就不讲一些大道理了.通俗点,我们对数据库的操作,无非就是增 删 改 查. 触发器就是在删,改,增的时候( ...
- 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 ...
- 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 ...
- NPOI 通用导出数据到Excel 分类: C# Helper 2014-11-04 16:06 246人阅读 评论(0) 收藏
应用场景: 在项目中,经常遇到将数据库数据导出到Excel,针对这种情况做了个程序封装.工作原理:利用NPOI将SQL语句查询出的DataTable数据导出到Excel,所见即所得. 程序界面: ...
- 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 ...
- 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 ...
- 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 ...
- {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 ...
随机推荐
- istio-jaeger-spring boot调用链配置
istio-jaeger-spring boot调用链配置 虽然,istio ingress controller已经生成了jaeger 记录所需要的信息,但是多个分布式之间没法清晰记录相互之间的依赖 ...
- spring boot (三): 热部署
介绍了Spring boot实现热部署的两种方式,这两种方法分别是使用 Spring Loaded和使用spring-boot-devtools进行热部署. 热部署是什么 大家都知道在项目开发过程中, ...
- pycharm和anaconda
借鉴其他博文和亲自操作做一简要的总结: anaconda是python中一个管理包很好用的工具,可以轻松实现python中的各种包的管理.相信大家会有这样的体验,在pycharm中也是有自动搜索和下载 ...
- websocket activemq
websocket:应用与服务端保持长连接 不停通信 activemq:偶发通信 心跳机制
- spring colud 博客
https://blog.csdn.net/forezp/article/details/70148833
- 52ABP视频学习
https://study.163.com/course/courseMain.htm?courseId=1005208064 网易视频 https://www.52abp.com/ReadWiki/ ...
- spring jpetstore研究入门(zz)
spring jpetstore研究入门 分类: java2008-12-21 23:25 561人阅读 评论(2) 收藏 举报 springstrutsibatissearchweb框架servle ...
- 2018.10.30 uoj#273. 【清华集训2016】你的生命已如风中残烛(组合数学)
传送门 组合数学妙题. 我们把这mmm个数都减去111. 然后出牌的地方就变成了−1-1−1. 然后发现求出每个位置的前缀和之后全部都是非负数. 考虑在最后加入一个−1-1−1构成一个m+1m+1m+ ...
- Java日期时间使用总结[转载]
Java日期时间使用总结 一.Java中的日期概述 日期在Java中是一块非常复杂的内容,对于一个日期在不同的语言国别环境中,日期的国际化,日期和时间之间的转换,日期的加减运算,日期的展示格式 ...
- urllib — URL handling modules
urllib is a package that collects several modules for working with URLs: •urllib.request for opening ...