home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-06-19 | 1.2 KB | 54 lines | [TEXT/CWIE] |
- (*
- Problem 03 - Perimeter
-
- You are in charge of protecting a set of defenseless homeowners from predators
- that roam the area by constructing a single fence of minimum length that
- encloses all of the homes.
-
- The prototype for your solution is as follows:
-
- typedef struct Node {
- long xCoord;
- long yCoord;
- } Node;
-
- void Perimiter(
- long numHomes,
- Node homesToEnclose[],
- long *numNodesInPerimiter,
- long nodesInPerimiter[]
- );
-
- You are given a list homesToEnclose of numHomes homes to protect (numbered 0
- to numHomes-1) by constructing a fence around the homes. You should return a
- list nodesInPerimiter of the numNodesInPerimiter homes to be connected by a
- fence. The fence must enclose all of the homes using the minimum amount of
- fencing material.
- *)
-
- unit Solution;
-
- interface
-
- // Do not modify the interface
-
- uses
- Types, Files;
-
- type Node = record
- xCoord: SInt32;
- yCoord: SInt32;
- end;
- type NodeArray = array [0..0] of Node;
- type UInt32Array = array [0..0] of UInt32;
-
- procedure Perimeter( numHomes: UInt32; const homesToEnclose: NodeArray; var numNodesInPerimeter : UInt32; var nodesInPerimeter: UInt32Array);
-
- implementation
-
- // Fill in your solution and then submit this folder
-
- // Team Name: FILL IN YOUR TEAM NAME!
-
- end.
-