Advertisement
ismail5g

Perter Smoke

Mar 24th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.25 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int n, p, k, l;
  5.     while(scanf("%d %d", &n, &k)!=EOF){
  6.         p=0;
  7.         l=n;
  8.         while(k<=n){
  9.             n=n/k;
  10.             p+=n;
  11.         }
  12.             printf("%d\n", l+p);
  13.     }
  14.     return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement