Exemplo n.º 1
0
        public IEnemy[] GetOrderedByHealth()
        {
            var newLegion = new OrderedBag <IEnemy>(CompareElements);

            newLegion.AddMany(this.legion);
            return(newLegion.ToArray());
        }
Exemplo n.º 2
0
        static void Main()
        {
            var framesCount = int.Parse(Console.ReadLine());

            OrderedBag <Frame> bag = new OrderedBag <Frame>();

            for (int i = 0; i < framesCount; i++)
            {
                var line = Console.ReadLine().Split();
                if (line[0].CompareTo(line[1]) < 0)
                {
                    bag.Add(new Frame(line[0], line[1]));
                }
                else
                {
                    bag.Add(new Frame(line[1], line[0]));
                }
            }

            var array = bag.ToArray();

            PermuteRep(array, 0, framesCount);

            Console.WriteLine(gigabag.Count);

            gigabag.Sort(new FramArrCompararer());

            foreach (var el in gigabag)
            {
                sb.AppendLine(string.Join(" | ", el.Select(e => string.Format("({0}, {1})", e.ToString()[0], e.ToString()[1]))));
            }

            Console.Write(sb.ToString());
        }