Well thanks . I was trying to implement this. But got stuck...
What about the boundary conditions.
When I m at 0,0
On 29 Jun 2012 02:03, "watashi" <[email protected]> wrote:
> for (int i = 0; i < 4; ++i) {
> int toX = fromX + mx[i];
> int toY = fromY + my[i];
> // ...
> }
>
> By this way, you can easily enumerate moving up/down/left/right instead of
> writing them four times. It more efficient for coding and less probable to
> introduce bugs (due to typo or copy/paste). It is a good practical to
> replace similar logicals and duplicate blocks with loop.
>
> On Thu, Jun 28, 2012 at 12:20 PM, Registered user <
> [email protected]> wrote:
>
>>
>>
>> final int[] mx = {0, 0, 1, -1};
>> final int[] my = {1, -1, 0, 0};
>>
>> i found the above line of code, in many solution that was related to
>> matrix (NxM). but i could not understand how it is being used. can any one
>> explain a bit. or give any link reference where i can find some short of
>> explanation related to this.
>> half thanks in advance and the other half after answering....
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Code Jam" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/google-code?hl=en.
>>
>
>
>
> --
> Sincerely,
>
> Zejun Wu (a.k.a. watashi)
>
> Rm. 218, International Conference Center, Zijingang Campus
> Zhejiang University, Hangzhou 310058
> Blog: http://watashi.ws/blog/
> Email: [email protected]
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-code?hl=en.