Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int height, width, length;
- cin >> height >> width >> length;
- long apartmentVolume = height * width * length;
- long boxVolume;
- while (cin >> boxVolume)
- {
- if (boxVolume == -1) {
- cout << "Do I have space for my Audi A6? Space left: " << apartmentVolume << endl;
- return 0;
- }
- if (apartmentVolume >= boxVolume) {
- apartmentVolume -= boxVolume;
- } else {
- cout << "No more space. You need " << (boxVolume - apartmentVolume) << " space more." << endl;
- return 0;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement