pku2244 Eeny Meeny Moo

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;

#ifdef _WIN32
#define i64 __int64
#define out64 "%I64d\n"
#define in64 "%I64d"
#else
#define i64 long long
#define out64 "%lld\n"
#define in64 "%lld"
#endif
/************ for topcoder by zz1215 *******************/
#define FOR(i,a,b)      for( int i = (a) ; i <= (b) ; i ++)
#define FFF(i,a)        for( int i = 0 ; i < (a) ; i ++)
#define FFD(i,a,b)      for( int i = (a) ; i >= (b) ; i --)
#define S64(a)          scanf(in64,&a)
#define SS(a)           scanf("%d",&a)
#define LL(a)           ((a)<<1)
#define RR(a)           (((a)<<1)+1)
#define pb              push_back
#define CL(Q)           while(!Q.empty())Q.pop()
#define MM(name,what)   memset(name,what,sizeof(name))
#define read            freopen("in.txt","r",stdin)
#define write           freopen("out.txt","w",stdout)

const int inf = 0x3f3f3f3f;
const i64 inf64 = 0x3f3f3f3f3f3f3f3fLL;
const double oo = 10e9;
const double eps = 10e-9;
const double pi = acos(-1.0);

// i64 gcd(i64 a,i64 b){return b?gcd(b,a%b):a;}

int n;

bool can(int x)
{
	int now = n-1;
	int pos = 0;
	int temp;
	while(now > 1)
	{
		temp = pos+x;
		temp = (temp-1)%now+1;
		if(temp==1)
		{
			return false;
		}
		else
		{
			now--;
			pos = temp-1;
		}
	}
	return true;
}

int start()
{
	for(int i=2;;i++)
	{
		if(can(i))
		{
			return i;
		}
	}
}

int main()
{
	while(cin>>n)
	{
		if(!n) return 0;
		cout<

你可能感兴趣的:(pku2244 Eeny Meeny Moo)