Akutagawa_Kanami @ 2024-07-30 18:10:55
#include <stdio.h>
int main()
{
int have=0;
int change=0;
int total=0;
int b=0;
scanf("%d %d",&have,&change);
int c=have;
do{
have=have/change;
b+=have;
}while(have>0);
total=b+c;
printf("%d",total);
return 0;
}
by lucasjj @ 2024-07-30 18:24:18
@ Luminous2006
ans&=0;
cin>>n>>k;
ans+=n;
int q=n,p=0,m=0;
while(q>=k)
{
p=q;
m=q%k;
q/=k;
ans+=q;
q=m+p/k;
}
cout<<ans;
}