比赛 |
20111108 |
评测结果 |
AAAWWWWWWW |
题目名称 |
分裂 |
最终得分 |
30 |
用户昵称 |
苏轼 |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2011-11-08 10:25:10 |
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
int n;
unsigned long long q[2][10012]={{0}};
int main()
{
freopen ("mushroom.in","r",stdin);
freopen ("mushroom.out","w",stdout);
scanf("%d",&n);
q[0][1]=1;
for (int i=1;i<=n;i++)
{
if (i%2==1)
{
for (int j=2;j<=i+1;)
{
q[i%2][j]=q[(i+1)%2][j-1]+q[(i+1)%2][j+1];
j+=2;
}
}
else
{
for (int j=1;j<=i+1;)
{
q[i%2][j]=q[(i+1)%2][j-1]+q[(i+1)%2][j+1];
j+=2;
}
}
}
int answer=0;
for (int i=1;i<=n+1;i++)
{
answer+=q[n%2][i];
}
cout<<answer;
return 0;
}
/*
void jia(int i,int x,int y)
{
for (int i=0;i<ji;i++)
{
q[i%2][(x+y)%2][i]=q[(i+1)%2][x][i]+q[(i+1)%2][y][i];
}
for (int i=0;i<ji;i++)
{
if (q[i%2][(x+y)%2][i]>=base)
{
q[i%2][(x+y)%2][i]=q[i%2][(x+y)%2][i]%base;
q[i%2][(x+y)%2][i+1]++;
if (i==ji-1)
{
ji++;
}
}
}
}
void jia1(int y)
{
for (int i=0;i<ji;i++)
{
answer[i]+=q[n%2][i];
}
for (int i=0;i<ji;i++)
{
if (answer[i]>=1000000)
{
q[i%2][(x+y)%2][i]=q[i%2][(x+y)%2][i]%1000000;
q[i%2][(x+y)%2][i+1]++;
if (i==ji-1)
{
ji++;
}
}
}
}
*/