View Code of Problem 20

#include<iostream>
#include<cmath>
using namespace std;
int main() {
	int n; 
	while(cin>>n) {
		if(n==1||n%2==0) cout<<"Yes"<<endl; 
		else {
			int m=2,j=1,flag=0;
			while(m<n) {
				if(n-m==1||(n-m)%2==0||n-m!=3) j++;
				else {
					flag=1;
					break;
				}
				m=pow(2,j);
			}
			if(flag==1)	cout<<"Yes"<<endl;
			else cout<<"No"<<endl;
		}
	}
}

Double click to view unformatted code.


Back to problem 20