Sale!

COMP 321: Programming Challenges Assignment 2

$30.00

Category:
Rate this product

COMP 321: Programming Challenges
Assignment 2
This assignment includes two problems, one problem on kattis and one separate.
Please remember that the assignment must be solved individually. What I expect from
you is to upload the following in the “Assignment 2” folder:
1) The codes that you used for solving the problems. The files must be named
Problem_ IDi.extension, where ‘Problem’ is the problem ID, IDi is
your McGill id and ‘extension’ is the program extension (.java).
NOTE: Make sure to add comments to your code.
2) A .pdf file for kattis problems. This .pdf must be named Assignment2_IDi.pdf, where
IDi is your McGill id number. Inside the pdf file, include a screenshot of the acceptance
notification that you received on your Kattis account. Please make sure your name
appears in it.
The due date for this assignment is Sunday September 30th before 11:59 PM.
A. Kattis problems
For this assignment, we will solve the following problem on kattis:
1. Disastrous Downtime: https://open.kattis.com/problems/downtime
B. Separate problem
Problem: Vegetable Baskets
ProblemID: vbasket
Sami is the boss of a vegetables company (Sami Vegetables). He wants to introduce a
new product – vegetable baskets. They will contain all possible combinations of
vegetables to satisfy different customer needs, but at most one piece of each type of
vegetables. He doesn’t want to have small vegetable baskets, so all baskets must contain
at least 200 grams of vegetables.
You have tolerated his ideas before, but you can’t put up with this one. You realized that
the company might end up with 2
𝑁 − 1 different baskets, where 𝑁 is the number of types
of vegetables the company sells. You know that Sami will not understand this argument,
so you are going to convince him in a different way. You want to tell him the total weight
of vegetables of all possible baskets, to clarify that he will need a lot of trucks just to carry
them.
For simplicity, you assume that all vegetables of the same kind weigh the same. You also
know that all vegetables weigh at least 50 grams.
Input
The first line of input contains an integer 𝑁, 1 ≤ 𝑁 ≤ 40. The second line
contains 𝑁 integers – weights of available vegetables types in grams. All weights are
integers between 50 and 1000.
Output
Output one line with one integer – the total weight of all vegetables in the baskets that
have at least 200 grams of vegetables.
Sample Input 1
4
50 60 70 120
Sample Output 1
1020

Open chat
Need help?
Hello
Can we help you?