Skip to content

Latest commit

 

History

History

10346-peter's-smokes

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Peter's smokes

Solution

#include <iostream>
#include <cstdio>
using namespace std;

int main() {
    int n, k, count;

    while( scanf("%d %d", &n, &k) == 2) {
        count = n;
        while(n >= k) {
            count += n / k;
            n=(n/k)+(n%k);
        }
        cout << count << endl;
    }

    return 0;
}

This is only for discussion and communication. Please don't use this for submission of assignments.