|
|
back to boardHelp Posted by sialLeo 30 Mar 2013 01:59 What's wrong with this code? var i,n,num:integer; ch:char;st:string; begin readln(n); for i:=1 to n do begin readln(st); num:=ord(st[2])-ord('0'); ch:=st[1]; if ((ch='a')or(ch='h')) then begin if ((num=1)or(num=8)) then writeln(2) else if ((num=2)or(num=7)) then writeln(3) else if num in[3..6] then writeln(4); end else if ((ch='b')or(ch='g')) then begin if ((num=1)or(num=8)) then writeln(3) else if ((num=2)or(num=7)) then writeln(4) else if num in[3..6] then write(6); end else if ((ch='c')or(ch='d')or(ch='e')or(ch='f')) then begin if ((num=1)or(num=8)) then writeln(4) else if ((num=2)or(num=7)) then writeln(6) else if num in[3..6] then writeln(8); end; end; end. I've tested all 64 cases and it works, but i still get WA2. Edited by author 30.03.2013 02:00 Re: Help else if num in[3..6] then write(6); should be writeln(6). everything else is fine ;) Re: Help Thank you, bro! :) |
|
|