Sunday, 3 June 2012

UVa 11723 Numbering Roads Solution

#include <cstdio>

int main(void){
 int R, N;
 for(int cnum = 0; (scanf("%d %d", &R, &N) && R); ){
  printf("Case %d: ", ++cnum);
  int s = (R - 1)/N;
  if(s > 26) printf("impossible\n");
  else printf("%d\n", s);
 }
 return 0;
}

8 comments:

  1. ভাইয়া, s= (R-1)/N এইটা বুঝলামনা :(

    ReplyDelete
  2. #include
    int main()
    {
    int r,n,i,rest,x;
    for(i=1; ;i++)

    {
    scanf("%d%d",&r,&n);
    if(r==0&&n==0)
    {
    break;
    }
    if(n*26<r)
    {
    printf("Case %d: impossible\n",i);
    }
    else
    {


    rest=r-n;
    x=ceil((rest*1.0)/(n*1.0));
    printf("Case %d: %d\n",i,x);
    }



    }
    return 0;
    }

    ReplyDelete
  3. (R-1) r jigate R dele ki hoto?

    ReplyDelete