Sunday, April 10, 2011

11723 - Numbering Roads


#include<stdio.h>
#include<math.h>
int main()
{
    int r,n,s,k=1;
    //freopen("in.txt","r",stdin);

    while(scanf("%d%d",&r,&n)==2 && (r+n))
    {
        if(r/n==0)
        {
            printf("Case %d: 0\n",k++);
            continue;
        }
        s=ceil(double(r)/n)-1;
        if(s>26)
            printf("Case %d: impossible\n",k++);
        else
            printf("Case %d: %d\n",k++,s);
    }
    return 0;
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.