|
|
вернуться в форумHelp! I have wrong answer, but I don't understand why #include<stdio.h> int function(char,int); int main(void){ int i,b,n; int arr[1001]; 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; } |
|
|