比赛 |
防止浮躁的小练习v0.9 |
评测结果 |
AAAAAAAAAA |
题目名称 |
放棋子 |
最终得分 |
100 |
用户昵称 |
ZXCVBNM_1 |
运行时间 |
0.016 s |
代码语言 |
C++ |
内存使用 |
0.70 MiB |
提交时间 |
2016-11-07 19:40:38 |
显示代码纯文本
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<vector>
#include<bitset>
#include<set>
using namespace std;
struct node
{
int v[510],l;
void init(){memset(v,0,sizeof(v));l=0;}
}f[210];
node operator +(node A,node B)
{
int i;
node C;C.init();
C.l=max(A.l,B.l);
for(i=1;i<=C.l;i++)C.v[i]=A.v[i]+B.v[i];
for(i=1;i<=C.l;i++){C.v[i+1]+=C.v[i]/10;C.v[i]%=10;}
while(C.v[C.l+1]>0){C.l++;C.v[C.l+1]+=C.v[C.l]/10;C.v[C.l]%=10;}
return C;
}
node operator *(node A,int B)
{
int i;
for(i=1;i<=A.l;i++)A.v[i]*=B;
for(i=1;i<=A.l;i++){A.v[i+1]+=A.v[i]/10;A.v[i]%=10;}
while(A.v[A.l+1]>0){A.l++;A.v[A.l+1]+=A.v[A.l]/10;A.v[A.l]%=10;}
return A;
}
void print(node A)
{
for(int i=A.l;i>=1;i--)printf("%d",A.v[i]);
}
int main()
{
freopen("chess_2016.in","r",stdin);
freopen("chess_2016.out","w",stdout);
int n,i,j,a;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)scanf("%d",&a);
}
f[1].v[1]=0;f[1].l=1;
f[2].v[1]=1;f[2].l=1;
for(i=3;i<=n;i++)
{
f[i]=(f[i-1]+f[i-2])*(i-1);
}
print(f[n]);
fclose(stdin);
fclose(stdout);
return 0;
}