Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace Hello__France_MidExam_from_10.March
- {
- class Program
- {
- static void Main(string[] args)
- {
- var input = Console.ReadLine().Split("|");
- double budget = double.Parse(Console.ReadLine());
- var newPrices = new List<double>();
- for (int i = 0; i < input.Length; i++)
- {
- var items = input[i].Split("->");
- string name = items[0];
- double price = double.Parse(items[1]);
- double maxPrice = 0;
- if (name == "Clothes")
- {
- maxPrice = 50;
- }
- else if (name == "Shoes")
- {
- maxPrice = 35;
- }
- else if (name == "Accessories")
- {
- maxPrice = 20.5;
- }
- if (budget >= price && price <= maxPrice)
- {
- budget -= price;
- newPrices.Add(price * 1.4);
- }
- }
- for (int i = 0; i < newPrices.Count; i++)
- {
- Console.Write($"{newPrices[i]:f2} ");
- }
- Console.WriteLine();
- budget += newPrices.Sum();
- double profit = newPrices.Sum() - newPrices.Sum() / 1.4;
- Console.WriteLine($"Profit: {profit:f2}");
- if (budget >= 150)
- {
- Console.WriteLine("Hello, France!");
- }
- else
- {
- Console.WriteLine("Time to go.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement