Advertisement
NIKOLAY_TETUS

Untitled

Jun 13th, 2021
806
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. bool f(int x, int p)
  6. {
  7.     if (p > 3)
  8.         return false;
  9.  
  10.     if (x >= 34 && p == 3)
  11.         return true;
  12.  
  13.     if (f(x + 1, p + 1) == true && f(x + 2, p + 1) == true && f(x + 3, p + 1) == true && f(x * 2, p + 1) == true)
  14.         return true;
  15. }
  16.  
  17. int main()
  18. {
  19.     for (int S = 0; S < 33; S++)
  20.         if (f(S, 1))
  21.             cout << S << endl;
  22.  
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement