Saturday 26 March 2016

Solution of LIGHT OJ 1107 :: How Cow


Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.

/**Bismillahir Rahmanir Rahim.**/

#include <stdio.h>
int main()
{
    int a,b,c,d,e,f,g,h,i,j,x1,x2,y1,y2;
    scanf("%d", &a);
    for(b=1; b<=a; b++)
    {
        printf("Case %d:\n",b);
        scanf("%d%d%d%d", &x1,&y1,&x2,&y2);
        scanf("%d", &c);
        for(d=1; d<=c; d++)
        {
            scanf("%d %d", &e, &f);
            if(((e>=x1) &&(e<=x2)) && ((f>=y1)&&(f<=y2)))
                printf("Yes\n");
            else
                printf("No\n");
        }
    }
    return 0;
}

0 comments:

Post a Comment

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