2 solutions

  • 0
    @ 2024-12-16 16:15:46
    #include <iostream>
    using namespace std;
    #define endl '\n'
    
    const int N = 1e5 + 5;
    int n, dp[N] = {1, 1, 2};
    signed main()
    {
      cin >> n;
      for (int i = 3; i <= n; i++)
        dp[i] = dp[i - 3] + i / 2 + 1;
      cout << dp[n];
      return 0;
    }
    

    Information

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