lijuncheng_1207 @ 2023-06-25 19:08:42
#include<bits/stdc++.h>
using namespace std;
vector<int> addition(vector<int> &a,vector<int> &b){
vector<int> c;
int la=a.size(),lb=b.size(),ans=0;
if(la<lb)
return addition(b,a);
for(int i=0;i<=la;i++){
ans+=a[i];
if(i<lb) ans+=b[i];
c.push_back(ans%10);
ans/=10;
}
return c;
}
int main(){
vector<int> a,b,c;
int n;
cin>>n;
a.push_back(1);
b.push_back(2);
if(n<=2){
cout<<n;
return 0;
}
for(int i = 3; i <= n; i++){
c=addition(a,b);
a=b;
b=c;
}
int cl=c.size(),pos;
for(int i=cl-1;i>=0;i--){
if(c[i]>0){
pos=i;
for(int i=pos;i>=0;i--)
cout<<c[i];
return 0;
}
break;
}
return 0;
}
多多指教
by rainygame @ 2023-06-25 19:09:34
这标题,jbl(
by _rbq @ 2023-06-25 19:12:58
这东西洛谷很敏感,自重(指标题)
by WA_sir @ 2023-06-25 19:14:11
cao
by Kyl_in_2024 @ 2023-06-25 19:15:33
标题感人
验证码QQzp祭(QQ诈骗)
by InversionShadow @ 2023-06-25 19:20:13
zzmg,zs
by BrokenStar @ 2023-06-25 19:28:31
zzmg,jbl
by 1307_ @ 2023-06-25 19:30:46
第一眼甚至没发现标题的问题出在哪里
by Liquefyx @ 2023-06-25 19:57:16
标题zzmg,劝删
by Rieman_sum @ 2023-06-25 19:58:37
sqlm,jbl
by Eleveslaine @ 2023-06-25 19:59:08
诶这个标题是管理员顺手给改了是吧(