xuyangming @ 2024-08-06 14:30:00
#include<iostream>
using namespace std;
int a[105],la=1,b[105],lb=1,sum[105],lsum=1;
void cmp()
{
la=lb;
for(int i=1; i<=lb; i++)
a[i]=b[i];
lb=lsum;
for(int i=1; i<=lsum; i++)
b[i]=sum[i];
int c=0;
for(int i=1; i<=lsum; i++)
{
sum[i]=a[i]+b[i];
if(sum[i]>=10)
{
sum[i+1]++;
sum[i]-=10;
if(i==lsum)
{
lsum++;
}
}
}
}
int main()
{
int n;
cin>>n;
if(n==1||n==2)
{
cout<<n;
return 0;
}
a[1]=1;
b[1]=2;
for(int i=3; i<=n; i++)
{
cmp();
}
for(int i=lsum; i>=1; i--)
{
cout<<sum[i];
}
return 0;
}
by xuyangming @ 2024-08-06 14:30:31
一个关注
by YSchencheche @ 2024-08-06 14:32:24
需要高精