2 条题解

  • 3
    @ 2024-8-9 9:22:02
    #include<bits/stdc++.h>
    using namespace std;
    
    int f(int n)
    {
    	if(n <= 3) return 1;
    	return f(n - 1) + f(n - 2);
    }
    
    int main()
    {
    	int n;
    	cin >> n;
    	cout << f(n) << endl;
    	return 0;
    }
    • 1
      @ 2024-8-9 9:31:02
      #include<bits/stdc++.h>
      using namespace std;
      int f(int n) {
      	if(n<=3) return 1;
      	return f(n-1) + f(n-2);
      	
      }
      int main()
      {
      	int n;
      	cin>>n;
      	cout<<f(n)<<endl;
      }
      
      • 1

      信息

      ID
      368
      时间
      1000ms
      内存
      256MiB
      难度
      2
      标签
      (无)
      递交数
      156
      已通过
      92
      上传者