#include<stdio.h> int main() { int n,k,s,b,tb,r; while(scanf("%d%d",&n,&k)==2) { s=n; tb=0; while(s>=k) { b=s/k; r=s%k; s=b+r; tb=tb+b; } printf("%d\n",n+tb); } return 0; }
Wednesday, April 13, 2016
Subscribe to:
Post Comments (Atom)
Coprights @ 2016, Coder Cart
0 comments:
Post a Comment