Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace asd
- {
- class Program
- {
- static void Main(string[] args)
- {
- int bottlesOfDetergent = int.Parse(Console.ReadLine());
- bottlesOfDetergent *= 750;
- // 1 dish requere 5 mils of detergent
- // 1 pot requere 15 mils of detergent
- // every third load is only pots the other time is only dishes
- string command = Console.ReadLine();
- int count = 0;
- int mlFromDishes = 0;
- int dish = 0;
- int pot = 0;
- while (command != "End")
- {
- int dishes = int.Parse(command);
- count++;
- if (count == 3)
- {
- dishes *= 15;
- pot += int.Parse(command);
- count = 0;
- }
- else
- {
- dishes *= 5;
- dish += int.Parse(command);
- }
- mlFromDishes += dishes;
- if (mlFromDishes >= bottlesOfDetergent)
- {
- int necessaryDetergent = mlFromDishes - bottlesOfDetergent;
- Console.WriteLine($"Not enough detergent, {necessaryDetergent} ml. more necessary!");
- return;
- }
- command = Console.ReadLine();
- }
- int leftOverDetergent = bottlesOfDetergent - mlFromDishes;
- Console.WriteLine($"Detergent was enough!");
- Console.WriteLine($"{dish} dishes and {pot} pots were washed.");
- Console.WriteLine($"Leftover detergent {leftOverDetergent} ml.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement