home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1998 / MacHack 1998.toast / Programming Contest / MacHack Contest.sit / MacHack Contest / Problems Folder / Problem 03 - Perimeter / Solution.cp < prev    next >
MacBinary  |  1998-06-18  |  1.8 KB  |  [TEXT/CWIE]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert MS-DOS Code Page Info (other/dosCodePage) ext Unsupported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Thu Jun 18 12:48:46 1998, modified Thu Jun 18 12:48:46 1998, creator 'CWIE', type ASCII, 1035 bytes "Solution.cp" , at 0x48b 410 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[CWIE]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0b 53 6f 6c 75 74 69 | 6f 6e 2e 63 70 00 00 00 |..Soluti|on.cp...|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 00 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 00 04 0b 00 | 00 01 9a b1 ae f5 6e b1 |........|......n.|
|00000060| ae f5 6e 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..n.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 ac 73 00 00 |........|.....s..|
|00000080| 2f 2a 0d 50 72 6f 62 6c | 65 6d 20 30 33 20 2d 20 |/*.Probl|em 03 - |
|00000090| 50 65 72 69 6d 65 74 65 | 72 0d 0d 59 6f 75 20 61 |Perimete|r..You a|
|000000a0| 72 65 20 69 6e 20 63 68 | 61 72 67 65 20 6f 66 20 |re in ch|arge of |
|000000b0| 70 72 6f 74 65 63 74 69 | 6e 67 20 61 20 73 65 74 |protecti|ng a set|
|000000c0| 20 6f 66 20 64 65 66 65 | 6e 73 65 6c 65 73 73 20 | of defe|nseless |
|000000d0| 68 6f 6d 65 6f 77 6e 65 | 72 73 20 66 72 6f 6d 20 |homeowne|rs from |
|000000e0| 70 72 65 64 61 74 6f 72 | 73 0d 74 68 61 74 20 72 |predator|s.that r|
|000000f0| 6f 61 6d 20 74 68 65 20 | 61 72 65 61 20 62 79 20 |oam the |area by |
|00000100| 63 6f 6e 73 74 72 75 63 | 74 69 6e 67 20 61 20 73 |construc|ting a s|
|00000110| 69 6e 67 6c 65 20 66 65 | 6e 63 65 20 6f 66 20 6d |ingle fe|nce of m|
|00000120| 69 6e 69 6d 75 6d 20 6c | 65 6e 67 74 68 20 74 68 |inimum l|ength th|
|00000130| 61 74 0d 65 6e 63 6c 6f | 73 65 73 20 61 6c 6c 20 |at.enclo|ses all |
|00000140| 6f 66 20 74 68 65 20 68 | 6f 6d 65 73 2e 20 20 0d |of the h|omes. .|
|00000150| 0d 54 68 65 20 70 72 6f | 74 6f 74 79 70 65 20 66 |.The pro|totype f|
|00000160| 6f 72 20 79 6f 75 72 20 | 73 6f 6c 75 74 69 6f 6e |or your |solution|
|00000170| 20 69 73 20 61 73 20 66 | 6f 6c 6c 6f 77 73 3a 0d | is as f|ollows:.|
|00000180| 0d 74 79 70 65 64 65 66 | 20 73 74 72 75 63 74 20 |.typedef| struct |
|00000190| 4e 6f 64 65 20 7b 0d 09 | 6c 6f 6e 67 20 78 43 6f |Node {..|long xCo|
|000001a0| 6f 72 64 3b 0d 09 6c 6f | 6e 67 20 79 43 6f 6f 72 |ord;..lo|ng yCoor|
|000001b0| 64 3b 0d 7d 20 4e 6f 64 | 65 3b 0d 0d 76 6f 69 64 |d;.} Nod|e;..void|
|000001c0| 20 50 65 72 69 6d 69 74 | 65 72 28 0d 09 6c 6f 6e | Perimit|er(..lon|
|000001d0| 67 20 6e 75 6d 48 6f 6d | 65 73 2c 0d 09 4e 6f 64 |g numHom|es,..Nod|
|000001e0| 65 20 68 6f 6d 65 73 54 | 6f 45 6e 63 6c 6f 73 65 |e homesT|oEnclose|
|000001f0| 5b 5d 2c 0d 09 6c 6f 6e | 67 20 2a 6e 75 6d 4e 6f |[],..lon|g *numNo|
|00000200| 64 65 73 49 6e 50 65 72 | 69 6d 69 74 65 72 2c 0d |desInPer|imiter,.|
|00000210| 09 6c 6f 6e 67 20 6e 6f | 64 65 73 49 6e 50 65 72 |.long no|desInPer|
|00000220| 69 6d 69 74 65 72 5b 5d | 0d 29 3b 0d 0d 59 6f 75 |imiter[]|.);..You|
|00000230| 20 61 72 65 20 67 69 76 | 65 6e 20 61 20 6c 69 73 | are giv|en a lis|
|00000240| 74 20 68 6f 6d 65 73 54 | 6f 45 6e 63 6c 6f 73 65 |t homesT|oEnclose|
|00000250| 20 6f 66 20 6e 75 6d 48 | 6f 6d 65 73 20 68 6f 6d | of numH|omes hom|
|00000260| 65 73 20 74 6f 20 70 72 | 6f 74 65 63 74 20 20 28 |es to pr|otect (|
|00000270| 6e 75 6d 62 65 72 65 64 | 20 30 0d 74 6f 20 6e 75 |numbered| 0.to nu|
|00000280| 6d 48 6f 6d 65 73 2d 31 | 29 20 62 79 20 63 6f 6e |mHomes-1|) by con|
|00000290| 73 74 72 75 63 74 69 6e | 67 20 61 20 66 65 6e 63 |structin|g a fenc|
|000002a0| 65 20 61 72 6f 75 6e 64 | 20 74 68 65 20 68 6f 6d |e around| the hom|
|000002b0| 65 73 2e 20 59 6f 75 20 | 73 68 6f 75 6c 64 20 72 |es. You |should r|
|000002c0| 65 74 75 72 6e 20 61 0d | 6c 69 73 74 20 6e 6f 64 |eturn a.|list nod|
|000002d0| 65 73 49 6e 50 65 72 69 | 6d 69 74 65 72 20 6f 66 |esInPeri|miter of|
|000002e0| 20 74 68 65 20 6e 75 6d | 4e 6f 64 65 73 49 6e 50 | the num|NodesInP|
|000002f0| 65 72 69 6d 69 74 65 72 | 20 68 6f 6d 65 73 20 74 |erimiter| homes t|
|00000300| 6f 20 62 65 20 63 6f 6e | 6e 65 63 74 65 64 20 62 |o be con|nected b|
|00000310| 79 20 61 0d 66 65 6e 63 | 65 2e 20 20 54 68 65 20 |y a.fenc|e. The |
|00000320| 66 65 6e 63 65 20 6d 75 | 73 74 20 65 6e 63 6c 6f |fence mu|st enclo|
|00000330| 73 65 20 61 6c 6c 20 6f | 66 20 74 68 65 20 68 6f |se all o|f the ho|
|00000340| 6d 65 73 20 75 73 69 6e | 67 20 74 68 65 20 6d 69 |mes usin|g the mi|
|00000350| 6e 69 6d 75 6d 20 61 6d | 6f 75 6e 74 20 6f 66 0d |nimum am|ount of.|
|00000360| 66 65 6e 63 69 6e 67 20 | 6d 61 74 65 72 69 61 6c |fencing |material|
|00000370| 2e 0d 2a 2f 0d 0d 23 69 | 6e 63 6c 75 64 65 20 22 |..*/..#i|nclude "|
|00000380| 53 6f 6c 75 74 69 6f 6e | 2e 68 22 0d 0d 2f 2f 20 |Solution|.h"..// |
|00000390| 46 69 6c 6c 20 69 6e 20 | 79 6f 75 72 20 73 6f 6c |Fill in |your sol|
|000003a0| 75 74 69 6f 6e 20 61 6e | 64 20 74 68 65 6e 20 73 |ution an|d then s|
|000003b0| 75 62 6d 69 74 20 74 68 | 69 73 20 66 6f 6c 64 65 |ubmit th|is folde|
|000003c0| 72 0d 0d 2f 2f 20 54 65 | 61 6d 20 4e 61 6d 65 3a |r..// Te|am Name:|
|000003d0| 20 46 49 4c 4c 20 49 4e | 20 59 4f 55 52 20 54 45 | FILL IN| YOUR TE|
|000003e0| 41 4d 20 4e 41 4d 45 21 | 0d 0d 70 61 73 63 61 6c |AM NAME!|..pascal|
|000003f0| 20 76 6f 69 64 20 50 65 | 72 69 6d 65 74 65 72 28 | void Pe|rimeter(|
|00000400| 0d 09 55 49 6e 74 33 32 | 20 6e 75 6d 48 6f 6d 65 |..UInt32| numHome|
|00000410| 73 2c 0d 09 63 6f 6e 73 | 74 20 4e 6f 64 65 20 68 |s,..cons|t Node h|
|00000420| 6f 6d 65 73 54 6f 45 6e | 63 6c 6f 73 65 5b 5d 2c |omesToEn|close[],|
|00000430| 0d 09 55 49 6e 74 33 32 | 20 2a 6e 75 6d 4e 6f 64 |..UInt32| *numNod|
|00000440| 65 73 49 6e 50 65 72 69 | 6d 65 74 65 72 2c 0d 09 |esInPeri|meter,..|
|00000450| 55 49 6e 74 33 32 20 6e | 6f 64 65 73 49 6e 50 65 |UInt32 n|odesInPe|
|00000460| 72 69 6d 65 74 65 72 5b | 5d 0d 29 20 7b 0d 09 2a |rimeter[|].) {..*|
|00000470| 6e 75 6d 4e 6f 64 65 73 | 49 6e 50 65 72 69 6d 65 |numNodes|InPerime|
|00000480| 74 65 72 20 3d 20 30 3b | 0d 7d 0d 00 00 00 00 00 |ter = 0;|.}......|
|00000490| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000500| 00 00 01 00 00 00 01 54 | 00 00 00 54 00 00 00 46 |.......T|...T...F|
|00000510| 2b 30 38 30 30 31 35 3a | 35 35 3a 33 32 20 31 39 |+080015:|55:32 19|
|00000520| 39 38 00 00 00 00 00 00 | 00 00 b1 78 6a 77 00 00 |98......|...xjw..|
|00000530| 0b 53 6f 6c 75 74 69 6f | 6e 2e 63 70 61 63 48 61 |.Solutio|n.cpacHa|
|00000540| 63 6b 20 43 6f 6e 74 65 | 73 74 31 2e 73 69 74 69 |ck Conte|st1.siti|
|00000550| 02 4a 50 61 72 74 53 49 | 54 21 00 00 00 00 00 00 |.JPartSI|T!......|
|00000560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000570| 00 00 b1 b0 40 8c 00 00 | 00 00 00 00 01 9a 00 00 |....@...|........|
|00000580| 00 00 29 bc 7f 92 00 00 | 00 00 20 52 65 3a 20 46 |..).....|.. Re: F|
|00000590| 6f 6c 64 65 72 20 48 69 | 65 72 61 72 63 68 79 20 |older Hi|erarchy |
|000005a0| 44 75 70 6c 69 63 61 74 | 69 6f 6e 0d 00 00 00 00 |Duplicat|ion.....|
|000005b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005c0| 00 00 00 00 00 00 00 00 | 00 04 36 35 37 a4 00 00 |........|..657...|
|000005d0| 00 00 00 00 00 00 00 00 | 00 01 be ab 00 00 05 f2 |........|........|
|000005e0| 00 00 02 90 02 07 31 32 | 2f 35 2f 39 38 34 30 30 |......12|/5/98400|
|000005f0| 30 32 31 3a 30 31 3a 35 | 36 20 31 39 39 38 00 00 |021:01:5|6 1998..|
|00000600| 00 00 00 48 00 0a 47 65 | 6e 65 76 61 00 00 00 00 |...H..Ge|neva....|
|00000610| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000620| 00 00 00 00 00 00 00 02 | 00 02 00 28 00 0a 01 c2 |........|...(....|
|00000630| 02 80 00 28 00 0a 01 c2 | 02 80 b1 ae ad 73 00 00 |...(....|.....s..|
|00000640| 04 0b 00 00 04 0b 00 00 | 01 5c 01 00 00 00 00 04 |........|.\......|
|00000650| 00 01 00 01 00 00 01 00 | 00 00 01 54 00 00 00 54 |........|...T...T|
|00000660| 00 00 00 46 00 ce 0d f8 | 26 32 00 00 00 1c 00 46 |...F....|&2.....F|
|00000670| 00 01 4d 50 53 52 00 00 | 00 12 4d 57 42 42 00 00 |..MPSR..|..MWBB..|
|00000680| 00 1e 03 ed ff ff 00 00 | 00 00 00 00 00 00 03 f0 |........|........|
|00000690| ff ff 00 00 00 4c 00 00 | 00 00 00 00 00 00 00 00 |.....L..|........|
|000006a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+