Pages

Sunday 9 September 2012

UVA - 10346 - Peter's Smokes

#include <stdio.h>

int main()
{
    long x,y;
    while(scanf("%ld %ld",&x,&y)==2){
        long temp=x+((x-1)/(y-1));
        printf("%ld\n",temp);
     }
    return 0;
}

2 comments:

  1. Replies
    1. by some trials and some guess ...
      found that
      val = x + (x-1)/(y-1)

      Delete