using System; using System.Collections; using System.Collections.Generic; using System.Drawing; namespace A333835 { class Program { static void Main(string[] args) { List seq = new List(); Size z = new Size(); int n = 0; while (!Out(z) && seq.Count < 10000) { n++; if (!Seen(z)) { foreach (Size p in seq) { See(p + p - z); See(z + z - p); } seq.Add(z); Console.WriteLine("{0} {1}", seq.Count, n); } z = Move(z); } } static Size Move(Size z) { int w = Math.Max(Math.Abs(z.Width), Math.Abs(z.Height)); if (z.Height == -w) { return z + new Size(1, 0); } else if (z.Width == -w) { return z + new Size(0, -1); } else if (z.Height == w) { return z + new Size(-1, 0); } else { return z + new Size(0, 1); } } static bool Out(Size z) { return Math.Max(Math.Abs(z.Width), Math.Abs(z.Height)) > W; } static bool Seen(Size z) { return seen[z.Width + W][z.Height + W]; } static void See(Size z) { if (!Out(z)) { seen[z.Width + W][z.Height + W] = true; } } private const int W = 1000; private static readonly BitArray[] seen = new BitArray[2 * W + 1]; static Program() { for (int m = 0; m < seen.Length; m++) { seen[m] = new BitArray(2 * W + 1); } } } }