ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1197. Lonesome Knight

Please give me test №1.
Posted by Grigorenko Vlad 10 Jun 2012 02:33
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.
Posted by Ivan Metelev 1 Nov 2014 16:56
 test №1 is
3
a1
d3
g6