Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 13th, 2009, 05:14 AM
Registered User
 
Join Date: Dec 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Talking NEED A SOLUTION/S FOR SITUATION....

BIQ-004-FlukeLandCrawler
Time limit : 10 secs. (The program must produce output for all test cases within the stipulated time)

A spaceship carrying a convention of high ranking officials had a close shave with a meteor. They are now scattered over the surface over a meteor and the spaceship is beyond repair.
Fluke LandCrawler was an emergency replacement for a space rescue mission in the distant galaxy Alfa-Bentauri. You are KHAL – the computer on the land-Rover carrying Fluke. He needs to rescue as many survivors as possible but can’t figure out the best path. Fluke lied about his CompSc. Degree to get in to SpaceTravel Inc; he is banking on you to save his job.
Just to make things worse, Fluke’s shuttle was designed by Elbonians and not tested before being deployed due to this unforeseen emergency. You now find that the “Back”, “Left”, “Right” and “Fwd” buttons on the shuttle are unintuitive to say the least:
e.g. if Fluke’s Rover is in the slot marked as FL below (facing east), there are 4 possible slots that he can move to (shown in Blue). In short, it can not move back (towards the west) and is always facing east. He can only rescue people by moving to the slot that they are standing in.


Each survivor of the crash has a rank R (1<= R <= 5) e.g. some are Chancellors Rank5 and at the other end of the spectrum are Guards Rank1.
Determine the optimal path – that can
- save a group of people with the maximum total rank. High ranking officials are key to maintaining peace across various factions in the federation. Guards are sworn to protect them and will stay behind if required.
- If you have one optimal path, you should tell Fluke the command seq for the same. If more than one path is optimal, you should tell Fluke all the possible command seq and let him decide
- Time is of the essence – it is critical that the people be rescued as quickly as possible.

Input
- The first line contains n where n is the side of the square grid on which the rover will move. 4 <= n <= 100. Top-left co-ordinate is (0,0) and bottom right co-ordinate is (n-1, n-1)
- The next line is the number of test cases n (2 in the example below) that follow (< 5). Each test case is comprised of a number of lines.
o The first line of the test case contains the position where the space rover is beamed down/placed initially (facing east).
o The next line contains the number of survivors, k.
 This is followed by k lines, each having 3 integers relevant to each survivor. E.g. 1 3 5 indicates that there is a survivor at (1,3) and has Rank 5.

4
2
0 1
4
1 3 5
2 0 5
2 2 1
3 2 3
0 1
5
1 3 5
2 0 5
2 2 5
3 0 5
3 2 3


The test cases represent the following scenarios respectively.


Output
You should print out the results to console (via printf or equivalent)
For each test case, output the maximum cumulative rank of people you can save as the first line. That is to be followed by the command seq (1 or multiple) for the path(s) – See the example below.
8
LB
BL
10
RF

Explanation:



• You may implement the program in either C/C++/Java. If you choose to use C or C++ please mention the compiler version that you’re using in the email.
• Your program must accept a string as a command line argument. It should then proceed to open the file of that name in the same/current directory, which contains one or more test cases. Output should be printed to console via printf (or equivalent).
• The program will not expect any user input. Please test your program for compile / run time errors before submitting.
• You may submit multiple submissions – strive for solutions that are elegant, memory and time efficient.
• The time limit if specified is for all the test cases to be executed; the time limit is NOT per test case
Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a situation where categoryID parameter could receive value smaller than zero carewithl BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 October 7th, 2009 08:29 PM
Situation on Static IP Based SQL Server reyboy SQL Server 2000 1 April 4th, 2006 01:07 PM
strange situation Vishal_7 ASP.NET 1.0 and 1.1 Basics 0 December 16th, 2004 07:18 PM
Which solution should go eureka BOOK: ASP.NET Website Programming Problem-Design-Solution 1 September 5th, 2004 12:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.