Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Runtime.InteropServices.Marshalling;
- 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 (amountOfPreparation > 0)
- {
- string comandOrDishes = Console.ReadLine();
- if (comandOrDishes != "End")
- {
- if (washes < 3)
- {
- count = int.Parse(comandOrDishes);
- if (amountOfPreparation > 0)
- {
- amountOfPreparation -= count * 5;
- washes++;
- dishes += count;
- if (amountOfPreparation < 0 )
- {
- break;
- }
- }
- else
- {
- break;
- }
- }
- else
- {
- count = int.Parse(comandOrDishes);
- if (amountOfPreparation > 0)
- {
- amountOfPreparation -= count * 15;
- washes = 1;
- pots += count;
- if (amountOfPreparation < 0)
- {
- break;
- }
- }
- else
- {
- break;
- }
- }
- }
- else
- {
- break;
- }
- }
- if (amountOfPreparation >=0)
- {
- Console.WriteLine("Detergent was enough!");
- Console.WriteLine($"{dishes} dishes and {pots} pots were washed.");
- Console.WriteLine($"Leftover detergent {amountOfPreparation} ml.");
- }
- else
- {
- Console.WriteLine($"Not enough detergent, {Math.Abs(amountOfPreparation)} ml. more necessary!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement