Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int n, n1, k, i, m, count;
- while (scanf("%d %d", &n, &k) == 2)
- {
- count = n;
- n1 = n;
- while (n1 >= k)
- {
- count += n1 / k;
- n1 = n1 / k + n1 % k;
- }
- printf("%d\n", count);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment