Accept: 525 submit: 1137
Time Limit: 1000 msec memory limit: 32768 kb Problem Description
Peter hasNCigarettes. He smokes them one by one keeping all the butts. OutK> 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 valuesNAndK.
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 input4 3 10 3 100 5 sample output5 14 124 // The logic is simple, but let me TLE # Include <iostream> <br/> using namespace STD; <br/> int main () <br/> {<br/> int N, K, T; <br/> unsigned _ int64 re; <br/> while (scanf ("% d", & N, & K )! = EOF) <br/>{< br/> Re = 0; <br/> while (n> = K) <br/> {<br/> T = N/K; <br/> re + = T * k; <br/> N = T + N % K; <br/>}< br/> printf ("% i64u/N", RE + n); <br/>}< br/> return 0; <br/>}Times ....