Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _01._Dishwasher
- {
- class Program
- {
- static void Main(string[] args)
- {
- int bottles = int.Parse(Console.ReadLine());
- int detergentVol = bottles * 750;
- string input = string.Empty;
- int dishes = 0;
- int counter = 0;
- int plates = 0;
- int pots = 0;
- while (true)
- {
- input = Console.ReadLine();
- if (input == "End")
- {
- break;
- }
- counter++;
- if (counter % 3 == 0)
- {
- dishes = int.Parse(input);
- pots += dishes;
- detergentVol -= dishes * 15;
- }
- else
- {
- dishes = int.Parse(input);
- plates += dishes;
- detergentVol -= dishes * 5;
- }
- if (detergentVol < 0)
- {
- Console.WriteLine($"Not enough detergent, {Math.Abs(detergentVol)} ml. more necesary!");
- return;
- }
- }
- Console.WriteLine($"Detergent was enough!");
- Console.WriteLine($"{plates} dishes and {pots} pots were washed.");
- Console.WriteLine($"Leftover detergent {detergentVol} ml.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment