2 solutions

  • 0
    @ 2025-2-22 11:36:18
    #include<bits/stdc++.h>
    using namespace std;
    int f(int x){
    	if(x==1) return 0;
    	if(x==2) return 1;
    	return f(x-1)+f(x-2);
    }
    int main()
    {
    	int n;
    	cin>>n;
    	cout<<f(n);
    	return 0;
    }
    

    Information

    ID
    936
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    (None)
    # Submissions
    45
    Accepted
    26
    Uploaded By