Untitled

mail@pastecode.io avatar
unknown
c_cpp
18 days ago
598 B
0
Indexable
Never
#include <bits/stdc++.h>
using namespace std;

#define ll long long int
ll dp[10010];

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int n, m, k;
        scanf("%d %d %d", &n, &m, &k);
        
        int coin[n + 1];
        for (int i = 1; i <= n; i++)
            cin >> coin[i];

        dp[0] = 1;
        for(int i = 1; i <= n; i++) {
            for(int j = m; j >= coin[i]; j--)
                dp[j] += dp[j - coin[i]];
        }

        if(dp[m] >= k) cout << "ENOUGH" << endl;
        else cout << dp[m] << endl;
    }
    return 0;
}
Leave a Comment