示例#1
0
        static void Main()
        {
            var records = new List <long>();

            while (true)
            {
                try
                {
                    using (var sc = new SetConsole())
                    {
                        var sw = new Stopwatch();
                        sw.Start();
                        Program.Main(null);
                        sw.Stop();
                        records.Add(sw.ElapsedMilliseconds);
                        sw.Reset();
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    Console.WriteLine("\n====================");
                    Console.WriteLine("Process was supended");
                    Console.WriteLine("====================\n");
                }
                if (records.Any())
                {
                    Console.WriteLine("\n====================");
                    Console.WriteLine($"Time is {records.Last()}ms");
                    Console.WriteLine($"AveTime is {records.Average()}ms");
                    Console.WriteLine("====================\n");
                }
            }
        }
示例#2
0
        public static void Main(string[] args)
        {
            using (var sc = new SetConsole())
            {
                // [x, y]
                var map = new bool[12, 12];
                for (int y = 1; y <= 10; y++)
                {
                    var row = GetString();
                    for (int x = 1; x <= 10; x++)
                    {
                        map[x, y] = row[x - 1] == 'o' ? true : false;
                    }
                }

                for (int y = 1; y <= 10; y++)
                {
                    for (int x = 1; x <= 10; x++)
                    {
                        if (map[x, y])
                        {
                            continue;
                        }
                        var newMap = new bool[12, 12];
                        Array.Copy(map, newMap, 12 * 12);
                        DFS(newMap, x, y);
                        var flag = false;
                        for (int i = 1; i <= 10; i++)
                        {
                            for (int j = 1; j <= 10; j++)
                            {
                                flag = flag ? true : newMap[i, j];
                            }
                        }
                        if (!flag)
                        {
                            CWrite("YES"); return;
                        }
                    }
                }
                CWrite("NO");
            }
        }