首页 > 1005好玩的数列
头像 牛客74249822号
发表于 2020-04-14 08:30:03
这道题表面上是一道普普通通的递归,先放代码: #include <cstdio> using namespace std; int f(int n) { if(n <= 2) return 1; else return f(n - 1 展开全文
头像 奇幻的喵喵
发表于 2025-04-26 20:56:57
#include <iostream> using namespace std; int main() {     int arr[50];    &nbs 展开全文
头像 lkjhxx
发表于 2022-08-06 19:30:01
代码如下: n = int(input()) f = [1, 1] while len(f) < n: f.append(f[len(f) - 1] + f[len(f) - 2]) print(f[n - 1])
头像 中二的ssr在看数据
发表于 2020-11-26 21:28:56
相信题目都看得懂,分享一个自己的方法 #include <iostream> #include <cstdio> using namespace std; int main() { int a=0,b=1,n,m; cin>>n; m=n; 展开全文
头像 想润的菠萝蜜在备战秋招
发表于 2022-04-04 17:06:07
这题关键是要用数组来存放数据,用递归的话要堆栈溢出 #include<iostream>  using namespace std; int a[46]; int main() { int n; cin>>n; 展开全文