Wangxiaolong666 @ 2023-12-31 11:34:29
#include <bits/stdc++.h>
using namespace std;
long long s[5555][5555],l=1,n;
void WTF(int k)
{
for(int i=0;i<l;i++)
s[k][i]=s[k-1][i]+s[k-2][i];
for(int i=0;i<l;i++)
{
if(s[k][i]>=10)
{
s[k][i+1]+=s[k][i]/10;
s[k][i]=s[k][i]%10;
if(s[k][l])
l++;
}
}
}
int main()
{
cin>>n;
s[0][0]=1;
s[1][0]=2;
for(int i=2;i<n;i++)
WTF(i);
for(int i=l-1;i>=0;i--)
cout<<s[n-1][i];
return 0;
}
by __qkj__ @ 2023-12-31 11:49:22
@Wangxiaolong666 数组开太大了
by __qkj__ @ 2023-12-31 11:51:06
@Wangxiaolong666 long long s[5555][5555]
改为int s[5010][2010]