Advertisement
Alexander_B

Moving

Feb 9th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace DomashnoMoving
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int widthApartment = int.Parse(Console.ReadLine());
  14. int lenghtApartment = int.Parse(Console.ReadLine());
  15. int hightApartment = int.Parse(Console.ReadLine());
  16.  
  17. double volumeBoxes = 1.00;
  18.  
  19. double volumeApartment = 1.00 * widthApartment * lenghtApartment * hightApartment;
  20.  
  21.  
  22. while (true)
  23. {
  24. string inputData = Console.ReadLine().ToLower();
  25. if (inputData != "done")
  26. {
  27. int numberBoxes = int.Parse(inputData);
  28. double volumeOccupied = 1.00 * numberBoxes * volumeBoxes;
  29. volumeApartment -= volumeOccupied;
  30. if (volumeApartment < 0)
  31. {
  32. break;
  33. }
  34. }
  35. else
  36. {
  37. break;
  38. }
  39. }
  40.  
  41. if (volumeApartment >= 0)
  42. {
  43. Console.WriteLine($"{volumeApartment} Cubic meters left.");
  44. }
  45. else
  46. {
  47. double spaceNeeded = -1.00 * volumeApartment;
  48. Console.WriteLine($"No more free space! You need {spaceNeeded} Cubic meters more.");
  49. }
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement