Problem D
Planting Trees
Farmer Jon has recently bought
Help Jon to find out when is the earliest day when the party can take place. Jon can choose the order of planting the trees as he likes, so he wants to plant the trees in such a way that the party will be as soon as possible.
Input
The input consists of two lines. The first line contains a
single integer
Output
You program should output exactly one line containing one
integer, denoting the earliest day when the party can be
organized. The days are numbered
Sample Input 1 | Sample Output 1 |
---|---|
4 2 3 4 3 |
7 |
Sample Input 2 | Sample Output 2 |
---|---|
6 39 38 9 35 39 20 |
42 |
Footnotes
- Jon isn’t particularly hardworking.