Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Moving
- {
- class Program
- {
- static void Main(string[] args)
- {
- int width = int.Parse(Console.ReadLine());
- int length = int.Parse(Console.ReadLine());
- int height = int.Parse(Console.ReadLine());
- string command = Console.ReadLine();
- int volume = width * length * height;
- int spaceTaken = 0;
- while (command != "Done")
- {
- int boxes = int.Parse(command);
- spaceTaken += boxes;
- if (spaceTaken > volume)
- {
- int spaceNeeded = spaceTaken - volume;
- Console.WriteLine($"No more free space! You need {spaceNeeded} Cubic meters more.");
- break;
- }
- command = Console.ReadLine();
- }
- if (spaceTaken <= volume)
- {
- int spaceLeft = volume - spaceTaken;
- Console.WriteLine($"{spaceLeft} Cubic meters left.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment