Hello World
Tuesday, 8 May 2012
UVa 10346 Peter’s Smokes Solution
#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;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment