Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace test
- {
- class Program
- {
- static void Main(string[] args)
- {
- int km = int.Parse(Console.ReadLine());
- string dayNight = Console.ReadLine();
- decimal bestPrice = 0;
- decimal priceTaxi=decimal.MaxValue;
- decimal priceBus=decimal.MaxValue;
- decimal priceTrain=decimal.MaxValue;
- if (dayNight=="day")
- {
- priceTaxi = (decimal)(0.70 + 0.79 * km);
- }
- else if (dayNight=="night")
- {
- priceTaxi= (decimal)(0.70 + 0.90 * km);
- }
- if (km >= 20)
- {
- priceBus = (decimal)(0.09 * km);
- }
- if (km >= 100)
- {
- priceTrain = (decimal)(0.06 * km);
- }
- bestPrice = Math.Min(Math.Min(priceTaxi, priceBus),priceTrain);
- Console.WriteLine(bestPrice);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement