1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
IrinaK [193]
3 years ago
11

Given coins of denominations (value) 1 = v1 < v2< … < vn, we wish to make change for an amount A using as few coins as

possible. Assume that vi’s and A are integers. Since v1= 1 there will always be a solution. Solve the coin change using integer programming. For each the following denomination sets and amounts formulate the problem as an integer program with an objective function and constraints, determine the optimal solution.
What is the minimum number of coins used in each case and how many of each coin is used? Include a copy of your code.

a) V = [1, 5, 10, 25] and A = 202.
b) V = [1, 3, 7, 12, 27] and A = 293
Computers and Technology
1 answer:
astraxan [27]3 years ago
3 0

Answer:

Answer given below

Explanation:

a) 10 coins ( 25*8 + 1*2)

b) 14 coins (27*10 + 12*1 + 7*1 + 3*1 + 1*1)

<u></u>

<u>Source Code in C++: </u>

#include <iostream>

using namespace std;

//main function

int main()

{

int n,n1;

cout << "Enter the amount : "; //taking amount as input

cin >> n;

if(n<=0)

{

cout << "Fatal Error : Input Failure." << endl;

return 1;

}

cout << "Enter the number of denominations : "; //taking number of denominations as input

cin >> n1;

if(n1<=0)

{

cout << "Fatal Error : Input Failure." << endl;

return 1;

}

int a[n1],c[n1],sum=0; //array to keep count of each amount, and sum to store total coins

cout << "Enter the denominations in descending order : ";

for(int i=0;i<n1;i++)

{

cin >> a[i];

}

for(int i=0;i<n1;i++)

{

c[i]=n/a[i];

sum=sum+c[i];

n=n%a[i];

}

for(int i=0;i<5;i++)

{

cout << a[i] << " : " << c[i] << endl;

}

return 0;

}

You might be interested in
Convert each of the following for loops into an equivalent while loop. (You might need to rename some variables for the code to
MAVERICK [17]

Answer:

~CaptnCoderYankee

Don't forget to award brainlyest if I got it right!

Download txt
5 0
3 years ago
There exists a data type Date with member function Increment that increments the current Date object by one. The ++ operator is
nalin [4]

Answer:

Date Date::operator++( int )

{

Date temp = *this;

Increment();

return temp;

}

Explanation:

Of options 1 through 4, only option 4 correctly implement the post increment of the ++ operator.

Interpreting each line of option for and comparing it to other options

Line 1: Date Date::operator++( int )

This declares the data type and its ++ operator

This is same for all options

Line 2: The Date type needs to be declared

In option 4, it was declared correctly as Date temp = *this;  using a pointer variable *this.

Here, option 2 is removed from the list of possible options.

Comparing other options

Line 3: The member increment option needs to be declared after the declaration of the date type variable.

This is correctly declared as Increment();  in option 4

Here, option 3 is removed from the list of possible options.

Comparing other options

Line 4: The value declared variable temp needs to be returned the way it was declared (without pointer indicator)

Hence, option 4 is best appropriate

3 0
3 years ago
Tom teaches in a high school. He wishes to sort a spreadsheet containing students' marks in various subjects by descending order
cricket20 [7]

Answer:

Select the data to sort

Explanation:

4 0
3 years ago
Getting access to web browsing software to install it on a computer or to update your existing software is called _________ .
Ivenika [448]

Answer:

Downloading and/or Burning it on to your computer

Hope this helped! if so please mark it as brainliest

Explanation:

8 0
3 years ago
Read 2 more answers
Next
andreyandreev [35.5K]

Answer:

sampling height

Explanation:

3 0
3 years ago
Other questions:
  • What are the 6 external parts of a computer
    14·1 answer
  • To save the changes to the layout of a table, click the Save button on the _____.
    13·1 answer
  • Which of these networks is primarily for posting and viewing photos?
    8·2 answers
  • Counter-controlled repetition is also known as:
    8·1 answer
  • Describe three perimeter intrusion detection systems and give an example of one that you have seen deployed either at work or an
    8·1 answer
  • What is the awnser ?
    11·1 answer
  • Which type of error occurred in the following lines of code?
    13·1 answer
  • Larry does not want to save his internet browsing details on his computer. What files should Larry delete to clear his informati
    13·2 answers
  • Python will ignore any line of code that begins with hashtag true or false​
    13·2 answers
  • Question 1 (1 point)
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!