It is year 2020 and after all the demonetization , 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 she just 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 may not have any repeats.
Input
Each consists of one line with three space-separated values C, N, and V, followed by another line with N distinct space-separated values representing the preexisting denominations, in ascending order


Are there any questions left?
New questions in the section C
Create a Free Account
Level up your programming skills with IQCode
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Pleased to see you again

Sign up to unlock all of IQCode features:
  • Master useful skills
  • Improve learning outcomes
  • Share your knowledge
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Master useful skills
  • Improve learning outcomes
  • Share your knowledge
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Looking for an answer to a question you need help with?
you have баллов