Challenge Number King
InterviewTime limit1sMemory limit512 MB
Given up to 20 card values, count how many integers from 1 to their total sum cannot be formed as a subset sum.
- Level
Medium5 of 10
- Topics
- Dynamic programming, Bit manipulation, Greedy, Sorting
- Solved
- No attempts yet
Problem
Today is a festive day.
While wandering around the festival wondering what to do, Baeknam found an event called Challenge Number King and, lured by the prize of 1,000,000 won, signed up right away.
Challenge Number King is a game where you combine number cards to make various numbers.
In this round, you win by calling out the count of numbers that cannot be made as a sum of the numbers written on the cards.
Help Baeknam take first place and enjoy the festival.

Input
The first line gives the number of cards ().
The second line gives numbers.
Each number in the input is a natural number no greater than 100,000,000.
Output
Let be the sum of the numbers written on all the cards. Output the count of natural numbers between 1 and inclusive that cannot be made.