Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double neededProfit = double.Parse(Console.ReadLine());
- string command = Console.ReadLine();
- double priceOfCocktail = 0;
- double finalPrice = 0;
- while(command != "Party!")
- {
- int numOfCocktails = int.Parse(Console.ReadLine());
- priceOfCocktail = command.Length;
- double priceOfOrder = priceOfCocktail * numOfCocktails;
- if (priceOfOrder % 2 != 0)
- {
- priceOfOrder *= 0.75; // Прилагаме отстъпката само към текущата поръчка
- }
- finalPrice += priceOfOrder; // Добавяме коригираната поръчка към общия приход
- if (finalPrice >= neededProfit)
- {
- Console.WriteLine("Target acquired.");
- Console.WriteLine($"Club income - {finalPrice:f2} leva.");
- break;
- }
- command = Console.ReadLine();
- }
- if (finalPrice < neededProfit)
- {
- Console.WriteLine($"We need {neededProfit - finalPrice:f2} leva more.");
- Console.WriteLine($"Club income - {finalPrice:f2} leva.");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement