2 solutions

  • 1
    @ 2025-2-22 14:49:08
    #include<bits/stdc++.h>
    using namespace std;
    const int N=50;
    int f[N]={0,1,1};
    int main()
    {
    	int n;
    	cin>>n;
    	for(int i=3;i<=n;i++)
    	{
    		f[i]=f[i-1]+f[i-4];
    	}
    	cout<<f[n];
    	return 0;
    }
    
    

    Information

    ID
    636
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    3
    Tags
    # Submissions
    39
    Accepted
    19
    Uploaded By