Answered step by step
Verified Expert Solution
Question
1 Approved Answer
-sher tdio tdlib LIN LIN t put It is year 2020 and after all the demonetizations, our country has N different positive integer denominations
-sher tdio tdlib LIN LIN t put It is year 2020 and after all the demonetizations, our country has N different positive integer denominations of coin for all transactions. The finance minister went bonkers when a citizen tried to pay his taxes with a giant sack of low-valued coins, and decreed that no more than C coins of any one denomination may be used in any one purchase. For instance, if C = 2 and the existing denominations are 1 and 5, it is possible to buy something of value 11 by using two 5s and one 1, or something of value 12 by using two 5s and two 1s, but it is impossible to buy something of value 9 or 17. You cannot directly challenge the finance minister's decree, but you happen to be in charge of the mint, and you can issue new denominations of coin. Being a smart cookie, you want to make it possible for any item of positive value at most V to be purchased under the new rules. (Note that this may not necessarily have been possible before the FM's decree). Moreover, you want to introduce as few new denominations as possible, and your final combined set of pre-existing and new denominations should not have any repeats. Input The first line consists of three space-separated values C, D and V . The second line consists of D distinct space-separated values representing the preexisting denominations, in ascending order Output A single value representing the minimum number of new denominations required ours 56 p 1 #include 2 #include 3 4 #ifndef MAX_LINE_SIZE 5 #define MAX_LINE_SIZE 1000 6 #endif 7 8- int main() { 9 10 11 12 char* input calloc(MAX_LINE_SIZE, sizeof(char)); // read input gets (input); 13 14 15 16 17 return 0; 18 } // print output printf("%s", input);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Heres the python code for the above ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started