题解 | #Fibonacci#EZ
Fibonacci
https://www.nowcoder.com/practice/17ad6908e36a49f4b06ea96936e8bb25
#include <iostream> using namespace std; int main() { int n; int fibo[40]; fibo[0] = 0; fibo[1] = 1; while (scanf("%d", &n) != EOF) { // 注意 while 处理多个 case for(int i = 2; i <= n; i++){ fibo[i] = fibo[i - 1] + fibo[i - 2]; } printf("%d\n", fibo[n]); } } // 64 位输出请用 printf("%lld")