Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int x,y,t,i;
- scanf("%d",&t);
- for(i=1;i<=t;i++)
- {
- scanf("%d%d",&x,&y);
- int c=0;
- if( x-1>0 && y+2>0 && x-1<9 && y+2<9)
- c++;
- if(x+1>0 && y+2>0 && x+1<9 && y+2<9)
- c++;
- if(x-2>0 && y+1>0 && x-2<9 && y+1<9)
- c++;
- if(x+2>0 && y+1>0 && x+2<9 && y+1<9)
- c++;
- if(x-2>0 && y-1>0 && x-2<9 && y-1<9)
- c++;
- if(x+2>0 && y-1>0 && x+2<9 && y-1<9)
- c++;
- if(x-1>0 && y-2>0 && x-1<9 && y-2<9)
- c++;
- if(x+1>0 && y-2>0 && x+1<9 && y-2<9)
- c++;
- printf("Case %d: %d\n",i,c);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement