int grid[200][200] = {{0}};
int x=100;
int y=100;
int d = 0;
int count = 0;
for(int i = 0; i < 1018; ++i)
{
x += "BCBA"[d] - 'B';
y += "CBAB"[d] - 'B';
count += "CA"[grid[x][y]] - 'B';
d = (grid[x][y] ? "BCDA"[d] : "DABC"[d]) - 'A';
grid[x][y] ^= 1;
}
printf("%d\n", count);
On Jan 18, 4:28 am, Ravi Ranjan <[email protected]> wrote:
> i m searching for the approach to solve..... can u please tell the
> approach instead of answer....
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" 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/algogeeks?hl=en.