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