Task. Sums Write a program that inputs a sequence of Nintegers and finds out the smallest positive integer that cannot b

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Task. Sums Write a program that inputs a sequence of Nintegers and finds out the smallest positive integer that cannot b

Post by answerhappygod »

Task Sums Write A Program That Inputs A Sequence Of Nintegers And Finds Out The Smallest Positive Integer That Cannot B 1
Task Sums Write A Program That Inputs A Sequence Of Nintegers And Finds Out The Smallest Positive Integer That Cannot B 1 (22.22 KiB) Viewed 28 times
Code should be in c++
Task. Sums Write a program that inputs a sequence of Nintegers and finds out the smallest positive integer that cannot be presented as a sum of the elements of any subsequence (consisting of one or more elements, not necessarily consecutive) of the given sequence. Input On the first line, a value of N is written. On the second line, the elements of the given sequence are written, separated by spaces. Output One integer equals to the requested value. Constraints: 1<N< 1000; all the elements of the given sequence are integers in a range from -1000 to 1000 Example Input 5 1 -2 0 77 Output 2
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply