301995: CF379A. New Year Candles

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

New Year Candles

题意翻译

Vasily 是个喜欢浪漫的程序员,所以今年他打算用蜡烛装扮自己的房间。 Vasily 有a跟蜡烛。每当他点燃一根蜡烛,它会燃烧一个小时后熄灭。Vasily很聪明,他可以把b根燃尽的蜡烛拼接成一根好蜡烛,这根蜡烛和新蜡烛没什么两样。 Vasily想知道最多能让房间亮几个小时。 输入: 两个数, a,b 意义如题 输出: 一个数,表示房间最多能有烛光的小时数。 感谢@Maniac丶坚果 提供的翻译

题目描述

Vasily the Programmer loves romance, so this year he decided to illuminate his room with candles. Vasily has $ a $ candles.When Vasily lights up a new candle, it first burns for an hour and then it goes out. Vasily is smart, so he can make $ b $ went out candles into a new candle. As a result, this new candle can be used like any other new candle. Now Vasily wonders: for how many hours can his candles light up the room if he acts optimally well? Help him find this number.

输入输出格式

输入格式


The single line contains two integers, $ a $ and $ b $ $ (1<=a<=1000; 2<=b<=1000) $ .

输出格式


Print a single integer — the number of hours Vasily can light up the room for.

输入输出样例

输入样例 #1

4 2

输出样例 #1

7

输入样例 #2

6 3

输出样例 #2

8

说明

Consider the first sample. For the first four hours Vasily lights up new candles, then he uses four burned out candles to make two new ones and lights them up. When these candles go out (stop burning), Vasily can make another candle. Overall, Vasily can light up the room for 7 hours.

Input

题意翻译

Vasily 是个喜欢浪漫的程序员,所以今年他打算用蜡烛装扮自己的房间。 Vasily 有a跟蜡烛。每当他点燃一根蜡烛,它会燃烧一个小时后熄灭。Vasily很聪明,他可以把b根燃尽的蜡烛拼接成一根好蜡烛,这根蜡烛和新蜡烛没什么两样。 Vasily想知道最多能让房间亮几个小时。 输入: 两个数, a,b 意义如题 输出: 一个数,表示房间最多能有烛光的小时数。 感谢@Maniac丶坚果 提供的翻译

加入题单

上一题 下一题 算法标签: