프로그램 명: boi_candies
제한시간: 1 초
Kristian works as a shopkeeper and sells candies. There are N packages in his shop and each
of them may contain a difierent number of candies. When a customer comes and asks for K
candies, Kristian has to bring some packages, such that the total number of candies in those
packages is equal to K. If he is unable to do this, for example if someone asks for 4 candies
and there are only 5 packages with 3 candies in each of them, often the customer gets upset and
leaves.
Because of that, Kristian wanted to know how many difierent options he could provide to the
next customer with the packages he currently has. He managed to solve this problem and now
he is wondering what to do to improve the result. He wants to open one package and change the
number of candies in it so that the total number of distinct options he can ofier to the customer
will increase as much as possible.
입력
- The first line of the text file candies.in contains one integer N (2 ≤ N ≤ 100).
- The second line contains a sequence of N integers Bi (1 ≤ Bi ≤ 7 000) separated by single spaces
and describing the numbers of candies in each package.
출력
The first and only line of the text should contain two integers P and
Q separated by a single space. They mean that Kristian should take a package with P candies
and change the number of candies in it to Q. P has to be equal to one of Bi
. Since there can be many optimal results, output the one with P as small as possible. Among all results with
the minimal P, choose the smallest possible Q. You can assume that Kristian can increase the
total number of distinct orders he can serve by altering a single package.
입출력 예
입력
4
1 3 4 4
출력
4 9
입력
5
3 3 3 3 3
출력
3 1
samples
With the packages described in the first sample input file, Kristian can serve orders
of 9 difierent sizes, namely 1, 3, 4, 5, 7, 8, 9, 11 and 12. After changing a package with 4 candies
to 9 candies, he could serve orders of size 1, 3, 4, 5, 7, 8, 9, 10, 12, 13, 14, 16 and 17, which
makes 13 distinct options in total.
출처:boi 2010 day2 2/3
[질/답]
[제출 현황]
[푼 후(0)]