Advertisement
spasnikolov131

Untitled

Apr 22nd, 2022
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Best_Player
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double capacity = double.Parse(Console.ReadLine());
  10. double loadedSuitcase = 0;
  11. double suitcaseSize = 0;
  12. double lineIn = 0;
  13.  
  14. while (true)
  15. {
  16. string line = Console.ReadLine();
  17.  
  18. if (line == "End")
  19. {
  20. Console.WriteLine("Congratulations! All suitcases are loaded!");
  21. break;
  22. }
  23. if ((suitcaseSize +1) % 3 == 0)
  24. {
  25. lineIn = int.Parse(line);
  26. suitcaseSize = lineIn * 0.1;
  27. suitcaseSize = lineIn;
  28. loadedSuitcase++;
  29. }
  30. double leftedSpace = capacity - lineIn;
  31. loadedSuitcase++;
  32. leftedSpace -= lineIn;
  33.  
  34. if (capacity <= suitcaseSize)
  35. {
  36. Console.WriteLine("No more space!");
  37. }
  38. }
  39.  
  40. Console.WriteLine($"Statistic: {loadedSuitcase} suitcases loaded.");
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement