Advertisement
spasnikolov131

Untitled

Jul 13th, 2023
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. namespace Dishwasher
  5. {
  6. internal class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. int bottles = int.Parse(Console.ReadLine());
  11. int plates = 0;
  12. int pots = 0;
  13. int detergent = bottles * 750;
  14.  
  15. while (true)
  16. {
  17. string line = Console.ReadLine();
  18.  
  19. if (line == "End" || detergent > 0)
  20. {
  21. plates = int.Parse(line);
  22. detergent -= plates * 5;
  23. plates++;
  24.  
  25. if (int.Parse(line) % 3 == 0)
  26. {
  27. pots = int.Parse(line);
  28. detergent -= pots * 15;
  29. pots++;
  30. }
  31. }
  32. line = Console.ReadLine();
  33.  
  34.  
  35. }
  36.  
  37. Console.WriteLine("Detergent was enough!");
  38. Console.WriteLine($"{plates} dishes and {pots} pots were washed.");
  39. Console.WriteLine($"Leftover detergent {detergent} ml.");
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement