Пример #1
0
        public delegate void FinishLength(int a);//делегат для задачи всем финиша

        public Game(List<Car> cars)
        {
            this.cars = cars;
            start = new StartLength(cars[0].SetMilage);
            finish = new FinishLength(cars[0].SetRouteLenght);
            allCarsFinished = new EventHandler(race_AllCarsFinished);
            //криво, конечно
            for (int i = 1; i < cars.Count; ++i)
            {
                start += cars[i].SetMilage;
                finish += cars[i].SetRouteLenght;
            }
        }
Пример #2
0
        public delegate void FinishLength(int a); //делегат для задачи всем финиша

        public Game(List <Car> cars)
        {
            this.cars       = cars;
            start           = new StartLength(cars[0].SetMilage);
            finish          = new FinishLength(cars[0].SetRouteLenght);
            allCarsFinished = new EventHandler(race_AllCarsFinished);
            //криво, конечно
            for (int i = 1; i < cars.Count; ++i)
            {
                start  += cars[i].SetMilage;
                finish += cars[i].SetRouteLenght;
            }
        }
Пример #3
0
        private static SortedSet <StartLength> ReadInput()
        {
            var n   = int.Parse(Console.ReadLine());
            var all = new SortedSet <StartLength>();

            for (var i = 0; i < n; i++)
            {
                var ax     = Console.ReadLine().Split();
                var start  = uint.Parse(ax[0]);
                var length = uint.Parse(ax[1]);

                var startLength = new StartLength()
                {
                    Start  = start,
                    Length = length,
                    End    = start + length,
                    Index  = i
                };

                all.Add(startLength);
            }

            return(all);
        }