xiaobeichen @ 2024-09-13 13:30:51
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int N=1e7+5;
int a[N]{0,1,2,3};
int main(){
int n;
cin>>n;
for(int i=4;i<=n;i++){
a[i]=a[i-1]+a[i-2];
}
cout<<a[n];
return 0;
}
by ___define___ @ 2024-09-13 13:36:42
@xiaobeichen a[N]后面加个=
by xiaobeichen @ 2024-09-13 13:44:46
@define_sb_114514 谢谢
by xiaobeichen @ 2024-09-13 13:46:27
@define_sb_114514 还是不行QwQ\kk
by liruizhou_lihui @ 2024-09-13 13:52:59
@xiaobeichen 哥们这题高精度啊你编译成功也过不了
by Fess @ 2024-09-13 13:53:25
乐
by ___define___ @ 2024-09-13 13:55:45
@xiaobeichen
#include<bits/stdc++.h>
#define LL long long int
using namespace std;
const int N=1e7+5;
LL a[N];
int main(){
int n;
a[1]=1,a[2]=2,a[3]=3;
cin>>n;
for(int i=4;i<=n;i++){
a[i]=a[i-1]+a[i-2];
}
cout<<a[n];
return 0;
}
60分,要用高精或者你可以用python,像我一样
by xiaobeichen @ 2024-09-13 13:59:28
@define_sb_114514 谢