示例#1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Console.WriteLine("))");
            FileParser parser   = new FileParser();
            CityData   cityData = parser.ParseFile("e_high_bonus.in");
            Algorithm  alg      = new Algorithm("resultE.txt");

            Car[] carsss = alg.PickUpRide(cityData.rides.ToList(), cityData.settings);
            alg.CreateFile(carsss);
            Console.WriteLine("end");
        }
示例#2
0
        public CityData ParseFile(string path)
        {
            string[] stringArray = new string[6];
            stringArray = File.ReadAllLines(path);
            CityData cityData = new CityData();

            cityData.rides = new Ride[stringArray.Length - 1];

            cityData.settings = getSetting(stringArray[0]);

            for (int i = 1; i < stringArray.Length; i++)
            {
                cityData.rides[i - 1] = ParseFirstLive(stringArray[i], i - 1);
            }
            Console.WriteLine("Finish parae");
            double average = cityData.rides.Average(x => x.distance);

            return(cityData);
        }