Advertisement
krasio12356

Autonomy

Apr 17th, 2018
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.                                 // Autonomy
  5.  
  6. int main()
  7. {
  8.     string s;
  9.     int a, b, c;
  10.     cin >> a >> b >> c;
  11.     int v = a * b * c;
  12.     getline(cin, s);
  13.     int count = 0;
  14.     for (;;)
  15.     {
  16.         getline(cin, s);
  17.         if (s == "Done") break;
  18.         count = count + stoi(s);
  19.         if (count > v)
  20.         {
  21.             printf("No more free space! You need %d Cubic meters more.\n", count - v);
  22.             return 0;
  23.         }
  24.     }
  25.     printf("%d Cubic meters left.\n", v - count);
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement