using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { static void Main(string[] args) { string input = Console.ReadLine(); decimal budget = decimal.Parse(Console.ReadLine()); decimal endProfit = 0; string[] types = input.Split('|').ToArray(); List reSell = new List(); foreach (var item in types) { string[] items = item.Split(new char[] { '-', '>' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); string type = items[0]; decimal priceTag = Convert.ToDecimal(items[1]); if (type == "Clothes" && priceTag <= 50.00M && budget >= priceTag) //budget >= priceTag { reSell.Add(priceTag * 1.4M); // removed Math.Round budget -= priceTag; endProfit += reSell[reSell.Count - 1] - priceTag; } else if (type == "Shoes" && priceTag <= 35.00M && budget >= priceTag) //budget >= priceTag { reSell.Add(priceTag * 1.4M); // removed Math.Round budget -= priceTag; endProfit += reSell[reSell.Count - 1] - priceTag; } else if (type == "Accessories" && priceTag <= 20.50M && budget >= priceTag) //budget >= priceTag { reSell.Add(priceTag * 1.4M); // removed Math.Round budget -= priceTag; endProfit += reSell[reSell.Count - 1] - priceTag; } } for (int i = 0; i < reSell.Count; i++) // printing {value:F2} { Console.Write($"{reSell[i]:f2} "); } Console.WriteLine(); Console.WriteLine($"Profit: {endProfit:F2}"); // printing {value:F2} if (reSell.Sum() + budget >= 150) { Console.WriteLine("Hello, France!"); } else { Console.WriteLine("Time to go."); } } } }