Marks :50
: 14 | : 0
Bob is a maths teacher of a class of $$$N$$$ students. The examination results are out and the marks obtained by the students are represented by the array $$$marks$$$. Bob is happy with the performance of the class and so he decided to gift every student equal number of balls. As Bob likes mathematics a lot, he decided to pick a number which is a factor of marks of all $$$N$$$ students in his class, and decided to gift that number of balls to every student.
As Bob wants to distribute the maximum number of balls, he can change the marks of at most one student, to any positive integer of his choice. Find the maximum number of balls Bob can distribute to each student.
The first line of input consists of a single integer $$$N$$$ $$$(2 \leq N \leq 10^5)$$$ $$$-$$$ the total number of students in the class. The second line of input consists of $$$N$$$ space separated integers $$$-$$$ where the $$$i_{th}$$$ integer denotes the marks of the $$$i_{th}$$$ student in the class $$$(1 \leq marks[i] \leq 10^9)$$$.
Output a single integer $$$-$$$ the maximum number of balls that can be distributed.
3 12 3 11
3
5 18 9 1 27 99
9
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.