#include <iostream>
using namespace std;
int  n,m;
int cnt;
int num[25];
void fun(int last,int total) {
    for(int i=last; i<n; i++) {
        if(total+num[i]==m) cnt++;
        fun(i+1,total+num[i]);
    }
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    fun(0,0);
    
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: