Farmer Jon has recently bought n tree seedlings that he wants to plant in his yard. It takes 1 day for Jon to plant a /problems/plantingtrees/file/statement/er 0001.JPG seedlingt, and for each tree Jon knows exactly in how many days after planting it grows to full maturity. Jon would also like to throw a party for his farmer friends, but in order to impress them he would like to organize the party only after all the trees have grown. More precisely, the party can be organized at earliest on the next day after the last tree has grown up. 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 N (1 < N < 100 000) denoting the number of seedlings. Then a line with N integers t; follows (1 < t; <1000 000), where t; denotes the number of days it takes for the ith tree to grow.
Farmer Jon has recently bought n tree seedlings that he wants to plant in his yard. It takes 1 day for Jon to plant a /problems/plantingtrees/file/statement/er 0001.JPG seedlingt, and for each tree Jon knows exactly in how many days after planting it grows to full maturity. Jon would also like to throw a party for his farmer friends, but in order to impress them he would like to organize the party only after all the trees have grown. More precisely, the party can be organized at earliest on the next day after the last tree has grown up. 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 N (1 < N < 100 000) denoting the number of seedlings. Then a line with N integers t; follows (1 < t; <1000 000), where t; denotes the number of days it takes for the ith tree to grow.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Solve in C , Asap please.

Transcribed Image Text:Farmer Jon has recently bought n tree seedlings that he
/problems/plantingtrees/file/statement/en
wants to plant in his yard. It takes 1 day for Jon to plant a
0001.JPG
seedling!, and for each tree Jon knows exactly in how
many days after planting it grows to fullmaturity. Jon would also like to throw a party for his farmer
friends, but in order to impress them he would like to organize the party only after all the trees have
grown. More precisely, the party can be organized at earliest on the next day after the last tree has
grown up.
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 N (1 <N< 100 000) denoting
the number of seedlings. Then a line with N integers t; follows (1 < t; < 1000 000), where t; denotes
the number of days it takes for the ith tree to grow.

Transcribed Image Text: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 1, 2, 3, ... beginning from the current moment.
Sample Input 1
Sample Output 1
4
7
2 3 4 3
Sample Input 2
Sample Output 2
6
42
39 38 9 35 39 20
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 7 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education