Advertisement
updown

Untitled

Sep 12th, 2021
810
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int m1, c1;
  7.     int m2, c2;
  8.     int m3, c3;
  9.     int bucket = 1;
  10.  
  11.   cin >> c1 >> m1;
  12.   // read in row 2: TODO
  13.   // read in row 3: TODO
  14.  
  15.   // TODO: for loop to repeat this 100 times
  16.   // (repeat everything 33 times, then do pour bucket 1 into 2 an extra time)
  17.  
  18.   // pour bucket 1 into bucket 2
  19.   m2 = m1 + m2;
  20.   m1 = 0;
  21.  
  22.   if (m2 > c2) {
  23.     // uh oh we overflowed!
  24.     int move_back = m2 - c2;
  25.     m1 = m1 + move_back;
  26.     m2 = m2 - move_back;
  27.   }
  28.  
  29.   // pour bucket 2 into bucket 3: TODO
  30.   // pour bucket 3 into bucket 1: TODO
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement