Start.X = str1[0]-97; Start.Y = str1[1]-49;
End.X = str2[0]-97; End.Y = str2[1]-49;
Distances.clear();
Guys I did't understand what this statement works in Knight move problem?
--
You received this message because you are subscribed to the Google Groups
Google Code Jam group.
To post to
so the code is not very readable, it might well had been:
Start.X = str1[0] - 'A'; Start.Y = str1[1] - '0';
...
it was to convert from ASCII code to number indexes.
8-)
On Mon, Dec 17, 2012 at 5:01 PM, karthikeyan balamurugan
sbk...@gmail.comwrote:
Start.X = str1[0]-97; Start.Y = str1[1]-49;
Agree with Neal
To read till the end of file, I would suggest to use
while (cin str1 str2) {
..
}
and then there is no need to take care of the last 'endl'.
the following code give me accepted.
http://ideone.com/ORzXcK
Parker
On 2012/12/13 13:34, Neal Zane wrote:
Not sure but could be
Hi Neal Parker,
Thanks a lot guys, I ran a testcase with an empty line at the end and as
you guys pointed out, it failed... I changed it the way you guys suggested,
it worked and got AC :)
Now, Can I improve my solution? I believe what I am doing in Update
function is overkill, plain BFS
You are doing a classical way which is fine (considering the size of the
problem).
I'd like to do it a more abstract way that:
* encode each cell to a number with ((row 3) + col) so there will be 64
cells and thus 64 numbers to represent them
* treat each number as a node and the nodes can be
Hi,
I believe it is a very simple problem but still getting WA... :(
Could you anyone please help me spotting the mistake?
http://ideone.com/dAsYdK
--
You received this message because you are subscribed to the Google Groups
Google Code Jam group.
To post to this group, send email to
Not sure but could be the last 'endl' for the last line you
intentionally avoided.
Note that UVa reports WA on mis-formatting, instead of PE (long ago since
host migration).
The while loop judging cin.eof() could also fail it if the input file has
extra lines that although the test cases are read