Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Mr. G. works as a tourist guide in Bangladesh. His current assignment is to show a group of tourists a distant city. As in all countries, certain pairs of cities are connected by two-way roads. Each pair of neighboring cities has a bus service that runs only between those two cities and uses the road that directly connects them. Each bus service has a particular limit on the maximum number of passengers it can carry. Mr. G. has a map showing the cities and the roads connecting them, as well as the service limit for each each bus service.
It is not always possible for him to take all the tourists to the destination city in a single trip. For ex, consider the following road map of seven cities, where the edges represent roads and the number written on each edge indicates the passenger limit of the associated bus service. It will take at least five trips for Mr. G. to take 99 tourists from city 1 to city 7, since he has to ride the bus with each group. The best route to take is 1 - 2 - 4 - 7. Help Mr. G. find the route to take all his tourists to the destination city in the minimum number of trips.
Input
The input will contain one or more test cases. The first line of each test case will contain two integers: N (N ≤ 100) and R, representing the number of cities and the number of road segments, respectively. Each of the next R lines will contain three integers (C1, C2, and P) where C1 and C2 are the city numbers and P (P > 1) is the maximum number of passengers that can be carried by the bus service between the two cities. City numbers are positive integers ranging from 1 to N. The (R+1)th line will contain three integers (S, D, and T) representing, respectively, the starting city, the destination city, and the number of tourists to be guided. The input will end with two zeros for N and R.
9.6. Problems 207
Output
For each test case in the input, first output the scenario number and then the minimum number of trips required for this case on a separate line. Print a blank line after the output for each test case.
Sample Input
7 10
1 2 30
1 3 15
1 4 10
2 4 25
2 5 60
3 4 40
3 6 20
4 7 35
5 7 20
6 7 30
1 7 99
0 0
Sample Output
Scenario #1
Minimum Number of Trips = 5 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9129274

Have any Question?


Related Questions in Computer Engineering

C programmingnbsphelp with a program positivec that include

***C PROGRAMMING***  Help with a program positive.c that include the following function: Void extract(int *a, int n, int *positive, int *size);  The function should use pointer arithmetic, not subscripting. The extract f ...

Answer the following question what is the subnet mask of a

Answer the following Question : What is the subnet mask of a prefix of 26? How you obtain that subnet mask? Describe a prefix length and its used to identify networks. Descibe the ISP Tiers, classification and purposes.

The economic dynamism which is the index of productive

The economic dynamism, which is the index of productive growth in dollars for countries that are designated by the World Bank as middle-income are in table #8.3.9 ("SOCR data 2008," 2013). Compute a 95% confidence interv ...

Study the information given below and answer the

Study the information given below, and answer the questions. For a long time, the Royal Victoria Hospital (RVH) worked with an information system that consisted of a mix of paper-based files and small independent databas ...

Question summarize the human-computer interface hci of

Question : Summarize the human-computer interface (HCI) of Microsoft Word 2013 and Visio 2013. Explain the importance of HCI and usability of the software. Be sure to note any commonalities between the applications and n ...

Problem belowwrite a program that uses a function that

Problem below: Write a program that uses a function that returns a number between 1 and 6. Use this function to simulate the roll of a die. Allow the user to specify the number of trials and then tabulate that number of ...

Suppose circle is a class derived from the class point now

Suppose, Circle is a class derived from the class Point. Now consider the following statements: Point p[] = new Point[12]; P[0] = new Circle(); Now suppose Circle has a method Area() computing are of a circle, and Point ...

In c languageread a integer number which has 2 digits after

In C language: Read a integer number which has 2 digits after the decimal point. The number also has at least 6 digits the decimal point. Extract all digits at even positions from before the decimal point. Print them in ...

Quesiton direct manipulation and virtual environments

Quesiton: "Direct Manipulation and Virtual Environments" Please respond to the following: • Your software development company has been contracted to build a tool that will manage user accounts and rights in an Active Dir ...

A factory makes parts for laptop computers including screws

A factory makes parts for laptop computers, including screws. The screws are required to have the right length. The lengths of the screws obey a normal distribution with mean μ=4.25 millimeters and standard deviation σ=0 ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As