Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // c#
- int[,] m = new int[w, h];
- // fill matrix m
- for (int i = 0; i < 2 * (w + h - 2); ++i)
- {
- int e = i < w - 1 ? m[i, 0]
- : i < w + h - 2 ? m[w - 1, i - w + 1]
- : i < 2 * w + h - 3 ? m[2 * w + h - 3 - i, h - 1]
- : m[0, 2 * (w + h - 2) - i];
- // do something with element e
- }
Add Comment
Please, Sign In to add comment