1 solutions

  • 0
    @ 2022-10-13 22:14:46
    #include <bits/stdc++.h>
    using namespace std;
    #define int long long
    #define x first
    #define y second
    #define LL long long
    typedef pair<int,int> PII;
    int dx[] = {-1, 1, 0, 0};
    int dy[] = {0, 0, -1, 1};
    const int N = 1e6 + 10, MOD = 1e9 + 10;
    int a[N], f[N];
    int n, m, res;
    
    
    void solve()
    {
        int n;
        cin >> n;
        f[0] = 1;
        for(int i = 1; i <= 3; i ++ )
        {
            for(int j = i; j <= n; j ++ )
                f[j] += f[j-i];
        }
        cout << f[n];
    
    }
    signed main()
    {
        solve();
        return 0;
    }
    
    • 1

    Information

    ID
    1221
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    6
    Tags
    # Submissions
    19
    Accepted
    10
    Uploaded By