Farmer Bill's Problem
来源:互联网 发布:51单片机如何烧录程序 编辑:程序博客网 时间:2024/05/16 00:54
Time Limit: 1000msMemory Limit: 32768KB 64-bit integer IO format: %I64d Java class name: Main
Submit Status PID: 24433
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?
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
我感觉这题很是变态,我想了好长时间,都没想出什么意思,真的崩溃了
这里写代码片这题我也是想了很长时间,还是做题少吧 1. 列表内容----#include <iostream> using namespace std; int main() { int n,k; int sum; while(cin>>n>>k) { sum=n; while(n>=k) { sum+=n/k; n=n/k+n%k; } cout<<sum<<endl; } return 0; }
0 0
- Farmer Bill's Problem
- FZU1150 Farmer Bill's Problem
- POJ 1899 Farmer Bill's Problem
- FZU 1150 Farmer Bill's Problem
- POJ 1899 Farmer Bill's Problem
- fzu 1150 Farmer Bill's Problem
- fzu 1150 Farmer Bill's Problem
- fzu 1150 Farmer Bill's Problem
- POJ 1899 Farmer Bill's Problem 笔记
- FZU 1150 Farmer Bill's Problem(逻辑推理题目)
- pku1899Farmer Bill's Problem
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem B: The Farmer’s Heritage
- 4th Jilin Province Collegiate Programming Contest-Problem B: The Farmer’s Heritage
- NOJ [1133] Farmer\'s Pearls
- bzoj 3368: [Usaco2004]Farmer John's View 约翰看山
- ZOJ Problem Set - 2679 Old Bill
- Life In Bill Gate's Eyes
- [转载]The Programmer's Bill of Rights
- Maven入门指南 :Maven 快速入门及简单使用
- RESTful API 设计最佳实践
- 60.JAVA编程思想——多线程
- HttpServletRequest
- LeetCode 135. Candy
- Farmer Bill's Problem
- css reset 重置样式 html5
- Shader 学习笔记 20160501
- python正则表达式指南
- 千里之行,始于足下
- 202. Happy Numbe
- 理解Tomcat(一) 利用Digester解析xml文件
- 2016/5/1
- 两分钟看懂空格替换