Difficulty Level : Easy
Submissions : 186
Asked In :
Marks :10
: 4 | : 1
You are given an infinite supply of coins of each denomination $$$D = \{D_0, D_1, D_2,......, D_{n-1}\}$$$. You need to figure out the total number of ways $$$W$$$, in which you can change value $$$V$$$ using coins of denominations from $$$D$$$. Print $$$0$$$ if a change isn't possible.
The first input line contains an integer $$$N$$$ $$$(1 \le N \le 10)$$$ — representing the total number of denominations.
The second input line contains $$$N$$$ integer values separated by a single space. The $$$i^{th}$$$ integer value represents the denomination value $$$D_i$$$ $$$(1 \le D_i \le 10^5)$$$. All $$$D_i$$$(s) are distinct.
The third line of input contains the value of $$$V$$$ $$$(1 \le V \le 2*10^3)$$$ — representing the value for which the change needs to be generated.
For each test case, print an integer denoting the total number of ways W, in which a change for V is possible.
2 30 70 50
0
3 1 1500 1000 2000
4
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.