联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2019-03-21 08:33

Project 3: Panther Party

Due: Saturday, 23 March 2019

The Task

One panther from each of N lairs where 1 < N ≤ 1,000 numbered 1…N is attending a big

gathering to be held at the lair numbered X where (1 ≤ X ≤ N).

A total of 1 ≤ M ≤ 100,000 unidirectional (one-way) paths connects the lairs;

path i requires Ti where 1≤ Ti ≤ 100 units of time to traverse.

Each panther must walk to the gathering and, and then return.

Each panther is smart and picks an optimal route with the shortest time.

A panther's return route might be different from the original route to the gathering, since

paths have to be considered one-way because of the different amount of time it takes

between the points due to the terain and various other factors.

What is the longest amount of time any panther must spend walking to the party and back?

Ada

You are required to use a priority queue from the Ada library of data strucures.

You are required to create your own generic Ada package for the sole purpose of

implementing Dijkstra's shortest path algorithm.

You are required to instantiate this generic Ada package twice.

Failure to comply with these requirements will result in the loss of many points.

A major enhancement to the predefined library in Ada 2005 is the addition of a container

library. The main packages in the container library can be grouped in various ways.

One set of packages concerns the manipulation of objects of definite types and another,

essentially identical, set concerns indefinite types (those type fo which one must give a

constraint). Another grouping is bounded versus unbounded. The capacity of bounded

instances is limited and specified when the package is instantiated. Queues were omitted

from the 2005 Container library, because they were deemed too elemetrary to be included

in the standard. However, task-safe queues are somewhat complex. Ada 2012 introuces a

synchronized inteface Queue.Containers.Synchronized_Queue_Interfaces

Input/Output

The input begins with three space-separated integers: N, M, and X. The next M lines

descibe a path ii with three space-separated integers: Ai, Bi, and Ti. These number

describe the path from the lair numbered Ai to the lair Bi and requires Ti time units to

cover.

The output is one positive integer.

The maximum any one panther must walk is 10 time units for the following input:

4 8 2

1 2 4

1 3 2

1 4 7

2 1 1

2 3 5

3 1 2

3 4 4

4 2 3


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp