Advertisement
skb50bd

UVa 11150 Cola

Aug 28th, 2015
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int remainder, cola;
  6.  
  7.     while(cin >> remainder){
  8.         for(cola = remainder, remainder++; remainder >= 3; remainder -= (remainder / 3) * 2)
  9.             cola += remainder / 3;
  10.         cout << cola << endl;
  11.     }
  12.     return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement