Advertisement
Guest User

Untitled

a guest
May 19th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. using  namespace std;
  3.  
  4.  
  5. int maybe(int N)
  6. {
  7.   if ( N < 0)
  8.     return 0;
  9.   else if ( N == 1)
  10.     return 1;
  11.   else
  12.     return ((maybe( N-3)) || (maybe( N-5)));
  13. }
  14. int main()
  15. {
  16.   int  N;
  17.   cin >>  N;
  18.   if (maybe(N)==1)
  19.     cout << "YES";
  20.   else
  21.     cout << " NO";
  22.   return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement