| 比赛 | 
    20120224 | 
    评测结果 | 
    AAAAAATAAA | 
    | 题目名称 | 
    小球钟—时间与运动 | 
    最终得分 | 
    90 | 
    | 用户昵称 | 
    Makazeu | 
    运行时间 | 
    0.000 s  | 
    | 代码语言 | 
    C++ | 
    内存使用 | 
    0.00 MiB  | 
    | 提交时间 | 
    2012-02-25 12:23:29 | 
显示代码纯文本
#include <cstdio>
#include <cstdlib>
#include <deque> 
using namespace std;
const int MAXN=720;
typedef deque<int> Deque;
Deque Minute;
Deque Five;
Deque Hour;
Deque Bot;
int N;
int M=0;
bool check()
{
	for(int i=0;i<N;i++)
	{
		if(Bot[i]!=i+1)
			return false;
	}
	return true;	
}
void Into3()
{
	int tmp;
	int tmp2;
	tmp2=Hour.back();
	Hour.pop_back();
	for(int i=1;i<=11;i++) 
	{
		tmp=Hour.back();
		Hour.pop_back();
		Bot.push_back(tmp);
	}
	Bot.push_back(tmp2); 
}
void Into2()
{
	int tmp;
	tmp=Five.back();
	Five.pop_back();
	Hour.push_back(tmp);
	for(int i=1;i<=11;i++)
	{
		tmp=Five.back();
		Five.pop_back();
		Bot.push_back(tmp);
	}
}
void Into1()
{
	int tmp;
	tmp=Minute.back();
	Minute.pop_back();
	Five.push_back(tmp);
	for(int i=1;i<=4;i++)
	{
		tmp=Minute.back();
		Minute.pop_back();
		Bot.push_back(tmp);
	}
}
void work()
{
	bool flag=false;
	while(!flag)
	{
		M++; 
		int tmp;
		for(int a=1;a<=12;a++)
		{
			for(int b=1;b<=12;b++)
			{
				for(int c=1;c<=5;c++)
				{
					tmp=Bot.front(); 
					Bot.pop_front();
					Minute.push_back(tmp);
				}
				Into1();
			}
			Into2();
		} 
		Into3();
		flag=check();
	}
	printf("%d\n",(M+1)/2);
}
int main()
{
	freopen("xqz.in","r",stdin);
	freopen("xqz.out","w",stdout);
	scanf("%d\n",&N);
	for(int i=1;i<=N;i++) Bot.push_back(i);	
	work();
	return 0;
}