|
|
back to boardPlease give me test №1. I have wrong answer in test 1 but I check all variants with chessboard and I get right answer #include<stdio.h> int function(char,int); int main(void){ int i,b,n; int arr[110]; char a; scanf("%d",&n); for(i=1;i<=n;i++){ scanf("%1s",&a); scanf("%d",&b); arr[i]=function(a,b); } for(i=1;i<=n;i++) printf("%d\n",arr[i]); return 0; } int function(char a, int b){ int kil; if(a>='c' && a<='f' && b>=3 && b<=6) kil=8; else if((((b==2) || (b==7)) && a>='c' && a<='f') || (b>=3 && b<=6 && ((a=='b') || (a=='g')))) kil=6; else if(((a=='a') || (a=='h')) && ((b==1) || (b==8))) kil=2; else if((((a=='a') || (a=='h')) && ((b==7) || (b==2))) || (((a=='b') || (a=='g')) && ((b==1) || (b==8) ))) kil=3; else kil=4; return kil; } Re: Please give me test №1. test №1 is 3 a1 d3 g6 |
|
|