Thinking of others there is very clear, I will not elaborate. Link
1#include <iostream>2#include <cstdio>3#include <cmath>4#include <cstring>5 using namespacestd;6 Const intmaxn= -+5;7 intN;8 structBig9 {Ten intNum[maxn],len; One }; A Big ANS[MAXN]; - - voidDou (Big &x) the { - for(intI=0; i<x.len;i++) - { -x.num[i]=x.num[i]*2; + if(i>0) - { +x.num[i]+=x.num[i-1]/Ten; Ax.num[i-1]=x.num[i-1]%Ten; at } - } - if(x.num[x.len-1]>9) - { -x.num[x.len]=x.num[x.len-1]/Ten; -x.num[x.len-1]=x.num[x.len-1]%Ten; inx.len++; - } to } + - voidPLU (Big x,big Y,big &z) the { *memset (Z.num,0,sizeof(Z.num)); $ intLength=Max (X.len,y.len);Panax Notoginseng for(intI=0; i<length;i++) - { thez.num[i]=z.num[i]+x.num[i]+Y.num[i]; +z.num[i+1]=z.num[i]/Ten; Az.num[i]=z.num[i]%Ten; the } + if(z.num[length]!=0) z.len=length+1; - Elsez.len=length; $ } $ - intMain () - { the while(SCANF ("%d", &n)! =EOF) - {Wuyians[0].num[0]=1; ans[0].len=1; theans[1].num[0]=1; ans[1].len=1; - for(intI=2; i<=n;i++) Wu { -Dou (ans[i-2]); AboutPLU (ans[i-2],ans[i-1],ans[i]); $ } - for(inti=ans[n].len-1; i>=0; i--) cout<<ans[n].num[i];cout<<Endl; - } - return 0; A}
"Recursion + high precision" poj2506-tiling