09. Moving - Programming Basics with C++
На различни компилатори ми излиза различно... Има ли някой който да е решил задачата? Благодаря предварително!
09. Moving - Programming Basics with C++ https://judge.softuni.bg/Contests/Compete/Index/1173#0
#include <iostream>
#include <string>
using namespace std;
int main() {
  int width, length, height;
  cin >> width >> length >> height;
  int totalSpace = width * length * height;
  int totalBoxes;
  int box;
  string input;
  cin >> input;
  
  while(input != "Done") {
  
    box = stoi(input);
    totalBoxes += box;
    if (totalSpace < totalBoxes) { break; }
    cin >> input;  
  }
  if (totalSpace < totalBoxes) {
    int res = totalBoxes - totalSpace;
    cout << "No more free space! You need " << res << " Cubic meters more." << endl;
  } else {
    int res = totalSpace - totalBoxes;
    cout << res << " Cubic meters left." << endl;
  }
  return 0;
}