AcWing 741. 斐波那契数列
作者:互联网
文章目录
AcWing 741. 斐波那契数列
本题链接:AcWing 741. 斐波那契数列
本博客给出本题截图:
AC代码
注:会爆int
代码:
#include <cstdio>
#include <iostream>
using namespace std;
int main()
{
long long f[61];
f[0] = 0, f[1] = 1;
for (int i = 2; i <= 60; i ++ ) f[i] = f[i - 1] + f[i - 2];
int n;
cin >> n;
while (n -- )
{
int x;
cin >> x;
printf("Fib(%d) = %lld\n", x, f[x]);
}
return 0;
}
标签:741,数列,int,斐波,那契,AcWing 来源: https://blog.csdn.net/qq_52156445/article/details/120616875