Advertisement
Josif_tepe

Untitled

Feb 15th, 2021
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int n;
  6.     cin >> n;
  7.     if(n % 4 == 0) {
  8.         cout << 0 << endl; // we do not have to buy any more apples to split them equally between our nephews
  9.     }
  10.     else if((n + 1) % 4 == 0) {
  11.         cout << 9 << endl; // we have to buy 1 apple with the cost of 9MKD to have apples which we can split between our nephews
  12.     }
  13.     else if((n + 2) % 4 == 0) {
  14.         cout << 18 << endl; // we have to buy 2 apples with the cost of 18MKD to have apples which we can split between our nephews
  15.     }
  16.     else if((n + 3) % 4 == 0) {
  17.         cout << 27 << endl; // we have to buy 3 more apples with the cost of 27MKD to have apples which can split between our nephews
  18.     }
  19.    
  20.     return 0;
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement