Question: Objective Give practice with recursion in C . Give practice with a combinations style algorithm in C . Story Your coworkers at the KAT Pet
Objective
Give practice with recursion in C
Give practice with a combinations style algorithm in C
Story
Your coworkers at the KAT Pet Shop are furiously working at catching all the elephants and
placing the new baits. In lighter news the families that have been fostering cats now want to
permanently adopt a group of them. The only problem is that they want to adopt the same group
of cats.
You are here to mediate by determining which cats will go to which family. Some cats are cozier
in certain houses, and some cats will increase or decrease the coziness of other cats that wind
up in the same house. Luckily, you have knowledge of exactly how much each cat affects the
coziness of each other cat, and how much each family affects the coziness of each cat.
Each family will need to have at least cat, and each cat will be adopted out to of the
families. We are interested in metrics,
The coziness sum across all cats
The coziness of the least cozy cat
Problem
You will be given the number of cats, the initial coziness for each family for each cat, and the
amount of coziness that each cat will change for each other cat based on their presence within
the same family.
Input
The input will begin with a single integer, N N representing the number of cats. The
next N lines each contain integers, the ith line represents the coziness the ith cat will start
with at each of the corresponding families. This value could be negative.
Following this will be N lines that each contain N integers. The ith integer on the jth line
represents the amount of coziness the jth cat will change by positive is an increase and
negative is a decrease if the ith cat is adopted by the same family as the jth cat. The
diagonal will always be That is the ith cat will not affect its own coziness value.
You are guaranteed that each coziness value will be in the range of
Output
Print integers on a single line. The first integer should be the maximum coziness sum possible
and the second integer should be the coziness of the least cozy cat when assigning the cats
such that the least cozy cat is as cozy as possible.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
