Page 6 of 6

Re: 10196 - Check The Check

Posted: Sun Sep 21, 2014 1:32 pm
by lighted
Increase array limit

Code: Select all

int cheque[300] = {0};
Always print a newline after last line.

Code: Select all

   for(i = 0; i < game; i++)
   {
      if(cheque[i] == 0)    printf("Game #%i: no king is in check.", i + 1);
      if(cheque[i] == 1)    printf("Game #%i: white king is in check.", i + 1);
      if(cheque[i] == 2)   printf("Game #%i: black king is in check.", i + 1);
      printf("\n");
   }
brianfry713 wrote:Input:

Code: Select all

PbprNPqR
BNRKbQ.n
p.qBpbrp
.N..R.NR
QRqn.R.b
Pp.bQRrq
rnnRrrBk
BRbbbNrQ

........
........
........
........
........
........
........
........
AC output:

Code: Select all

Game #1: both kings are in check.
According to problem description its invalid input/output
There will be no invalid characters (i.e. pieces) and there won't be a configuration where both kings are in check.

Re: 10196 - Check The Check

Posted: Mon Sep 22, 2014 8:53 pm
by brianfry713
I deleted that invalid input.

Re: 10196 - Check The Check

Posted: Fri Sep 26, 2014 2:07 am
by falc0n
lighted wrote:Increase array limit

Code: Select all

int cheque[300] = {0};
Always print a newline after last line.

Code: Select all

   for(i = 0; i < game; i++)
   {
      if(cheque[i] == 0)    printf("Game #%i: no king is in check.", i + 1);
      if(cheque[i] == 1)    printf("Game #%i: white king is in check.", i + 1);
      if(cheque[i] == 2)   printf("Game #%i: black king is in check.", i + 1);
      printf("\n");
   }
brianfry713 wrote:Input:

Code: Select all

PbprNPqR
BNRKbQ.n
p.qBpbrp
.N..R.NR
QRqn.R.b
Pp.bQRrq
rnnRrrBk
BRbbbNrQ

........
........
........
........
........
........
........
........
AC output:

Code: Select all

Game #1: both kings are in check.
According to problem description its invalid input/output
There will be no invalid characters (i.e. pieces) and there won't be a configuration where both kings are in check.
Thank you so much !

I've never thinked that there were going to have more than 200 tests. omg