Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Dishwasher
- {
- class Program
- {
- static void Main(string[] args)
- {
- int bottles = int.Parse(Console.ReadLine());
- int quantity = bottles * 750;
- int counter = 0;
- int dishes = 0;
- int pots = 0;
- while (quantity >= 0)
- {
- counter++;
- string command = Console.ReadLine();
- if (command == "End")
- {
- Console.WriteLine("Detergent was enough!");
- Console.WriteLine($"{dishes} dishes and {pots} pots were washed.");
- Console.WriteLine($"Leftover detergent {quantity} ml.");
- break;
- }
- if (counter == 3)
- {
- pots = pots + int.Parse(command);
- quantity -= 15 * int.Parse(command);
- counter = 0;
- }
- else
- {
- dishes = dishes + int.Parse(command);
- quantity -= 5 * int.Parse(command);
- }
- }
- if (quantity < 0)
- {
- quantity = Math.Abs(quantity);
- Console.WriteLine($"Not enough detergent, {quantity} ml. more necessary!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement