Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace MyApp // Note: actual namespace depends on the project name.
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int bottles = int.Parse(Console.ReadLine());
- int amountOfPreparation = bottles * 750;
- int washes = 1; int count = 0;
- int dishes = 0 , pots = 0 ;
- while (true)
- {
- string comandOrDishes = Console.ReadLine();
- if (comandOrDishes != "End")
- {
- count = int.Parse(comandOrDishes);
- if (washes < 3)
- {
- if (amountOfPreparation > 0)
- {
- amountOfPreparation -= count * 5; washes++; dishes += count;
- if (amountOfPreparation < 0 )
- {
- Console.WriteLine($"Not enough detergent, {Math.Abs(amountOfPreparation)} ml. more necessary!");
- break;
- }
- }
- else
- {
- Console.WriteLine($"Not enough detergent, {Math.Abs(amountOfPreparation)} ml. more necessary!");
- break;
- }
- }
- else
- {
- if (amountOfPreparation > 0)
- {
- amountOfPreparation -= count * 15; washes = 1; pots += count;
- if (amountOfPreparation < 0)
- {
- Console.WriteLine($"Not enough detergent, {Math.Abs(amountOfPreparation)} ml. more necessary!");
- break;
- }
- }
- else
- {
- Console.WriteLine($"Not enough detergent, {Math.Abs(amountOfPreparation)} ml. more necessary!");
- break;
- }
- }
- }
- else
- {
- Console.WriteLine("Detergent was enough!");
- Console.WriteLine($"{dishes} dishes and {pots} pots were washed.");
- Console.WriteLine($"Leftover detergent {amountOfPreparation} ml.");
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement