P1255 数楼梯 2021-05-15 5 笔记 ```cpp #include #include using namespace std; int a[5001],b[5001],c[5001],len=1; int main() { int n;cin>>n; a[1]=1,b[1]=2; for(int i=3;i<=n;i++) { memset(c,0,sizeof(c)); for(int j=1;j<=len;j++) { c[j]+=a[j]+b[j]; c[j+1]+=c[j]/10;c[j]%=10;if(c[len+1]) len++; } for(int j=1;j<=len;j++) a[j]=b[j]; for(int j=1;j<=len;j++) b[j]=c[j]; //c=a+b;a=b;b=c; } if(n==1) cout<<1; else if(n==2) cout<<2; else for(int i=len;i>=1;i--) cout< 本文链接: https://shrinken.pw/crash-2021-05-15_40-fml.html