Prize Money
Practice
4.3 (15 votes)
Algorithms
Dynamic programming
Hiring
Medium
Problem
81% Success 4229 Attempts 30 Points 2s Time Limit 256MB Memory 1024 KB Max Code

The Coder bank of Coderland has decided to start an offer for its account holders. The currency denominations used in Coderland are different than those used generally. There are $$N$$ currency denominations in Coderland which are given in the form of an array. The offer from the bank is that the account holder which requests the minimum amount greater than the maximum currency denomination available at the bank which cannot be paid to the account holder will be given a gift. Since you are a customer of this bank, you want to win this gift. Print the number which can get you this prize.

Input Format

The first line of input contains the integer $$N$$ denoting the number of currency denominations.
The second line of input contains $$N$$ integers separated by spaces denoting the currency denominations available at the bank.

Output Format

Print the number which denotes the value that can help you avail the Gift voucher.

Constraints

\(1\) \(\le\) $$N$$ \(\le\) \(100\)

\(1\) \(\le\) $${D_i}$$ \(\le\) \(10^6\)

NOTE: Consider the bank has an infinite supply of each denomination. If no such number exists, output "Fake Offer!" without quotes.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
28 votes
Tags:
AlgorithmsApprovedDynamic ProgrammingGame TheoryMathMediumOpen
Points:30
24 votes
Tags:
AlgorithmsC++CombinatoricsDynamic Programming
Points:30
7 votes
Tags:
Medium