1 solutions

  • 0
    @ 2026-11-13 20:21:18

    C++ :

    #include<bits/stdc++.h>
    #define M 505
    using namespace std;
    
    long long dp[M];
    int main(){
        int n;
        cin >> n;    
        dp[0] = 1;
        for (int i = 1;i<=n;i++){
            for (int j = n;j>=i;j--){
                dp[j] = dp[j] + dp[j-i];
            }
        }     
        cout << dp[n] - 1;    
        return 0;
    }
    
    • 1

    Information

    ID
    111
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By