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