#include
using namespace std;
int main() {
int n;
cin >> n;
long long fib[47] = {0, 1};
for (int i=2; i<=n; i++) {
fib[i]=fib[i-1]+fib[i-2];
}
cout << fib[n] << endl;
return 0;
}
using namespace std;
int main() {
int n;
cin >> n;
long long fib[47] = {0, 1};
for (int i=2; i<=n; i++) {
fib[i]=fib[i-1]+fib[i-2];
}
cout << fib[n] << endl;
return 0;
}
全部评论
相关推荐
11-28 19:50
哈尔滨理工大学 golang 点赞 评论 收藏
分享