Answered step by step
Verified Expert Solution
Question
1 Approved Answer
USACO # 3 Bessie has woken up on a strange planet. In this planet, there are N ( 1 < = N < = 1
USACO # Bessie has woken up on a strange planet. In this planet, there are N N months, with a aN days, respectively ai all ai are integers In addition, on the planet, there are also weeks, where each week is L days, with L being a positive integer. Interestingly, Bessie knows the following:
For the correct L each month is at least weeks long.
For the correct L there are at most distinct values of ai mod L
Unfortunately, Bessie has forgotten what L is Help her by printing the sum of all possible values of L
Note that the large size of integers involved in this problem may require the use of bit integer data types eg a long long in CC
Input Format input arrives from the terminal stdin:
The first line contains a single integer N The second line contains N spaceseparated integers, a aN
Output Format print output to the terminal stout:
A single integer, the sum of all possible values of L
Sample Input:
Sample Output:
The possible values of L are and For example, L is valid because each month is at least length days long, and each month is either or mod
Sample Input:
Sample Output:
The possible values of L are and For example, L is valid because each month is at least days long, and each month is either or mod
Scoring:
Inputs ~: ai
Inputs : No additional constraints
Please show me that your code shows the correct output for each of the following sample input
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started