10346 - Peter's Smokes
Solution:
#include < stdio.h >
int main()
{
int n,k,b,a;
while(scanf("%d %d",&n,&k)==2)
{
b=n;
while(n>=k)
{
b=b+n/k;
n=(n/k)+(n%k);
}
printf("%d\n",b);
}
}
Problem & Solution Download
int main()
{
int n,k,b,a;
while(scanf("%d %d",&n,&k)==2)
{
b=n;
while(n>=k)
{
b=b+n/k;
n=(n/k)+(n%k);
}
printf("%d\n",b);
}
}
Problem & Solution Download
No comments:
Post a Comment