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
Cuántos tipos de grua existen en el mundo​
natka813 [3]
Grúas semi pórtico, carretilla pórtico, side lifter, grúas torre, grúas puente, grúas flotantes... y mas
Espero q esto te ayude! :))
3 0
3 years ago
Hellpppppppppppppppp
jonny [76]

Answer:

i can't see your problem

6 0
2 years ago
Read 2 more answers
4.5 Code Practice
Alex787 [66]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

This program is written in C++.

                                                                         

#include <iostream>

using namespace std;

int main()

{

   

   string word;// variable for taking user input

   int cond;// to set condition true if user preses the stop and exit from loop

   

   cout<<"Enter word: \n";

   cin>>word;

   do// start while loop

   {

       

       

       if(word=="stop" || word =="STOP" || word == "Stop")// if user enter word stop, then program exit

       {

       cond=0;

       

       }

       else//otherwise loop continue

       {

           cout<<" You Entered "+ word +"\n";

           cout<<"Enter word: \n";

           cin>>word;

           cond=1;

       }

   }  

   while(cond == 1);// if user don't enter word "stop" loop run continuesly.  

   cout<<"Program exit";

   

   return 0;

}

5 0
3 years ago
Search engines enable you to:A. talk to people via the computer.B. locate Web pages related to a specific subject.C. connect to
GalinKa [24]
The correct answer is B. locate Web pages related to a specific subject.

An example of a search engine is Google: it helps you find Websites with the content you're looking for.
3 0
2 years ago
The HTML tag for the smallest heading is​ what​
Gre4nikov [31]

Answer:

The HTML <h1> to <h6> tag is used to define headings in an HTML document. <h1> defines largest heading and <h6> defines smallest heading.

Explanation:

5 0
3 years ago
Other questions:
  • Select the correct answer.
    15·1 answer
  • Wireless networks are the most difficult type of network to set up <br> true or false
    15·1 answer
  • A powerful computer that acts as a hub for other computers is a called a ______.
    6·2 answers
  • Columns are labeled with letters and Rows are labeled with numbers.
    5·1 answer
  • What is sun and what does it do?
    12·2 answers
  • A website for a certain political party or candidate is likely to have unbiased
    6·1 answer
  • What are the advantages of saving files in a cloud? <br>Please help!! ​
    11·2 answers
  • Genetics Vocabulary: no <br> Allele: Different versions of the same qene (Aa, Bb)
    11·1 answer
  • it just said i was blocked from brainly for a sec i was like- dang- then i logged in again then it was back to normal uHhHh can
    8·2 answers
  • While conducting routine maintenance, you discover a network server that needs to
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!