[ create a new paste ] login | about

Link: http://codepad.org/3jCiHBp2    [ raw code | output | fork ]

nilukush - C++, pasted on May 2:
#include <iostream>

namespace
{
	const int& SIX(6);
	const int& THREE(3);
	const int& SEVEN(7);
}

bool can_arrive(const int& point)
{
	if(point == 0) return true;
	if(point == 1) return true;
	if((point % SIX) == 0) return true;
	if((point % THREE) == 0) return true;
	
	for(int jump_one(SEVEN); jump_one <= point; jump_one += SIX)
	{
		if(jump_one == point) return true;
	}
	
	return false;
}

int main()
{
	int point;
	std::cin >> point;
	std::cout << (can_arrive(point) ? "yes" : "no");
	return 0;
}


Output:
1
yes


Create a new paste based on this one


Comments: