POJ 2509 Peter's smoke
来源:互联网 发布:在淘宝网开店要钱吗 编辑:程序博客网 时间:2024/05/16 10:11
一道简单题,模拟吸烟这个过程既可,每吸k根得到的,加上余下的的,再每k根的去吸。
Peter's smokes
Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 13338Accepted: 5315
Description
Peter has n cigarettes. He smokes them one by one keeping all the butts. Out of k > 1 butts he can roll a new cigarette.
How many cigarettes can Peter have?
How many cigarettes can Peter have?
Input
Input is a sequence of lines. Each line contains two integer numbers giving the values of n and k.
Output
For each line of input, output one integer number on a separate line giving the maximum number of cigarettes that Peter can have.
Sample Input
4 3
10 3
100 5
Sample Output
5
14
124
Source
The UofA Local 2000.10.14
代码如下
- POJ 2509 Peter's smoke
- OJ---Peter's Smoke
- POJ 2509 Peter's smokes
- POJ 2509【Peter's smokes】
- POJ 2509 Peter's smokes(水~)
- POJ 2509Peter's smokes (递归)
- POJ 2509 Peter's smokes G++
- pku 1421 poj 1421 Peter's calculator
- Peter's Laws
- Peter's Blog
- Peter's Smokes
- Peter's Hobby
- hdu4865 Peter's Hobby
- Peter's first blog
- poj2509 Peter's smokes
- Peter's Smokes
- Peter's Projective Matlab Function
- Peter's Story(C#委托)
- 数据库表的连接(Left join , Right Join, Inner Join)用法详解
- [继续讨论]关于Windows PE和.net assembly的加载
- 如何快速建立高质量的online store?
- apache 初试
- Data Structure: Shell Sort
- POJ 2509 Peter's smoke
- Android资源网站。
- PrefixSPAN 算法的windows 与 linux实现
- Intel CE3100(Canmore)多种方式启动
- C#日历控件使用介绍
- CSLA4正式版推出啦
- genesis如何安装
- hadoop的一个hdfs测试程序
- 应届生签约必须参考的九个注意事项来源: 张梦竹的日志