10346

Peter's Smoke
Type:
Simulation
Diff:3.0

Tricks

This problem tells us that Peter have n cigarettes. Your task is to find out how many cigarettes can he smoke using  his n cigarettes. How ? He can make a new cigarettes with k cigarette�s buttes and get another butte. So we need to simulate as following for finding the number.

cg is the number of cigarettes
b <- cg
while b > k
            p =

           
cg = cg + p
           
b = b%k + p;

Related Problems & Topics

 

If you have any advice, complements 

or proposal, please  Send mail to Author

Submit

 

1