MIRO
i need help with one exercise using cycles
Jack wanted to plant hyacinths. Hyacinth bulbs of N different colours were available on the market, with several bulbs of each colour. Jack bought all the bulbs offered, hoping to make a garden of hyacinths of all different colours. Then, without considering what he was doing, he mixed the bulbs. But the bulbs of hyacinths of different colours are exactly the same, and Jack got confused. It's good that he at least remembered how many bulbs of the different colours he had bought. How many least bulbs should Jack plant to be sure that there will be at least one hyacinth of each colour in his garden? Write a lilies program to calculate this number. We assume that one hyacinth will grow from each bulb.
Login
From the first line of the standard input, the number of different coloured hyacinths is entered. The number of colours is not greater than 7. From the second line, # positive integers are entered, separated by one space, the number of bulbs of different colours, and the number of bulbs of one colour is not greater than 20.
Exit
On the single line of standard output, the program should output the required minimum number of bulbs to be planted.
EXAMPLE
Login
3
9 6 8
Exit
18
if anyone can help, cant understand how make it shorter without writing so many console readlines and also i know that the minimum number could be found by Math.Max(of the number) + Math.Min(of the numbers) + their amount
i need it for sunday so please hurry up
157 replies