比赛 |
20140713下午练习 |
评测结果 |
AAAAAAAAAA |
题目名称 |
跳棋的挑战 |
最终得分 |
100 |
用户昵称 |
slyrabbit |
运行时间 |
1.599 s |
代码语言 |
C++ |
内存使用 |
0.31 MiB |
提交时间 |
2014-07-13 16:05:03 |
显示代码纯文本
#include<iostream>
#include<cstdio>
using namespace std;
int a[15]={0},s=0;
unsigned int n;
void putout()
{
for(int i=1;i<=n;i++)
{
cout<<a[i]<<" ";
}
cout<<endl;
}
void f(unsigned int j,unsigned int down,unsigned int left,unsigned int right)
{
unsigned int pos=0;
if(j>n)
{
s++;
if(s<=3)
putout();
return;
}
unsigned int temp;
temp=down|left|right;
pos=~temp;
pos&=(1<<n)-1;
int i;
while(pos)
{
i=(-pos)&pos;
pos-=i;
temp=i;
for(;;)
{
a[j]++;
if(temp&1)
break;
temp>>=1;
}
f(j+1,down+i,(left+i)<<1,(right+i)>>1);
a[j]=0;
}
}
int main()
{
freopen("checker.in","r",stdin);
freopen("checker.out","w",stdout);
cin>>n;
f(1,0,0,0);
cout<<s;
return 0;
}