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