Responsive Ads Here

Friday, October 24, 2014

UVA-10346 (Peter's Smokes) EASY

10346 - Peter's Smokes.c

 

0001

#include<stdio.h>
int main()
{ int n,K,i,sum,l,p;
while (scanf("%d%d",&n,&K)!=EOF)
{
int sum1=n;
for(i=0;i<n;n=sum)
{
if(n<K)
{
break;
}
l=n/K;
p=n%K;
sum=l+p;
sum1=sum1+l;
}
printf("%d\n",sum1);
}
return 0;
}


10346 - Peter's Smokes UVA link

No comments:

Post a Comment

php4

<?php    // Start the session  session_start();  ?>  <!DOCTYPE html>  <html>  <head>       <link rel=&q...