Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace bags
- {
- 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());
- int volume = width * length * height;
- int sumVolumeBags = 0;
- int differenceVolume = 0;
- while (true)
- {
- string input = Console.ReadLine();
- if (input != "Done")
- {
- int volumeBags = int.Parse(input);
- sumVolumeBags += volumeBags;
- differenceVolume = volume - sumVolumeBags;
- if (differenceVolume < 0)
- {
- Console.WriteLine("No more free space! You " +
- "need {0} Cubic meters more.",
- Math.Abs(differenceVolume));
- break;
- }
- }
- else
- {
- Console.WriteLine("{0} Cubic meters left.",
- differenceVolume);
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement