#K93342. Days to Finish Reading Books
Days to Finish Reading Books
Days to Finish Reading Books
Jenny is reading a series of books in a unique way. Instead of finishing one book before starting the next, she reads one chapter from each book every day. Given the number of chapters in each book, your task is to determine the number of days she will need to finish reading all the books.
Formally, you are given a positive integer \(N\) representing the number of books, and a list of \(N\) positive integers \(a_1, a_2, \dots, a_N\), where \(a_i\) is the number of chapters in the \(i\)-th book. Each day, Jenny reads one chapter from every book that still has unread chapters. Thus, the total number of days required is given by:
\[ \text{days} = \max_{1 \leq i \leq N} a_i \]Calculate and output the number of days required.
inputFormat
Input Format:
- The first line contains a single integer \(N\) — the number of books.
- The second line contains \(N\) space-separated integers \(a_1, a_2, \dots, a_N\) representing the number of chapters in each book.
outputFormat
Output Format:
- Output a single integer — the number of days Jenny needs to finish reading the books.
3
4 2 3
4