示例#1
0
 public string Working(out int threadId)
 {
     Console.WriteLine("Begin Work...");
     Thread.Sleep(CostTime);
     threadId = Thread.CurrentThread.ManagedThreadId;
     return(String.Format("{0} wasted {1} sec.", CodeName, CostTime.ToString()));
 }
示例#2
0
        /// <summary>
        /// Get toll fee by time
        /// </summary>
        /// <param name="date"></param>
        /// <param name="vehicle"></param>
        /// <returns></returns>
        private int GetTollFee(DateTime date, IVehicle vehicle)
        {
            if (vehicle.IsTollFreeVehicle() || date.IsTollFreeDate())
            {
                return(0);
            }
            var costTime = new CostTime(date.Hour, date.Minute);

            return(costTime.GetAmountOfTime());
        }
 /// <summary>
 ///  get Cost amount of time
 /// </summary>
 /// <param name="o"></param>
 /// <returns></returns>
 public static int GetAmountOfTime(this CostTime o)
 {
     return(o switch
     {
         CostTime t when t.Hour == 6 && t.Minute >= 0 && t.Minute <= 29 => Globals.AppConfiguration.FeeCostToTime.ZoneTime6a,
         CostTime t when t.Hour == 6 && t.Minute >= 30 && t.Minute <= 59 => Globals.AppConfiguration.FeeCostToTime.ZoneTime6a,
         CostTime t when t.Hour == 7 && t.Minute >= 0 && t.Minute <= 59 => Globals.AppConfiguration.FeeCostToTime.ZoneTime7,
         CostTime t when t.Hour == 8 && t.Minute >= 0 && t.Minute <= 29 => Globals.AppConfiguration.FeeCostToTime.ZoneTime8a,
         CostTime t when t.Hour >= 8 && t.Hour <= 14 && t.Minute >= 30 && t.Minute <= 59 => Globals.AppConfiguration.FeeCostToTime.ZoneTime8b,
         CostTime t when t.Hour == 15 && t.Minute >= 0 && t.Minute <= 29 => Globals.AppConfiguration.FeeCostToTime.ZoneTime15a,
         CostTime t when t.Hour == 15 && t.Minute >= 0 || t.Hour == 16 && t.Minute <= 59 => Globals.AppConfiguration.FeeCostToTime.ZoneTime15b,
         CostTime t when t.Hour == 17 && t.Minute >= 0 && t.Minute <= 59 => Globals.AppConfiguration.FeeCostToTime.ZoneTime17,
         CostTime t when t.Hour == 18 && t.Minute >= 0 && t.Minute <= 29 => Globals.AppConfiguration.FeeCostToTime.ZoneTime18,
         _ => Globals.AppConfiguration.FeeCostToTime.ZoneTimefree
     });
示例#4
0
    public static void Main(string[] args)
    {
        string[] line = Console.ReadLine().Split(' ');
        int      n    = int.Parse(line[0]);
        int      t    = int.Parse(line[1]);

        var ct = new CostTime[n];

        for (int i = 0; i < ct.Length; i++)
        {
            line  = Console.ReadLine().Split(' ');
            ct[i] = new CostTime(int.Parse(line[0]), int.Parse(line[1]));
        }
        var ict = ct.Where(v => v.time <= t);

        Console.WriteLine(ict.Any() ? ict.Min(v => v.cost).ToString() : "TLE");
        Console.ReadLine();
    }