Quantcast

Maximum PC

It is currently Sun Sep 21, 2014 9:37 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: The Countdown Problemie
PostPosted: Mon Oct 04, 2010 6:33 pm 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
I came across this problem watching a MSFT video. Personally, I think that it looks pretty interesting...

Problem: You are given six positive "source" numbers and a final answer. All of these will be natural numbers. Using the standard arithmetic operators (ie + - * /), construct an arithmetic statement using the source integers that is equal to the answer.

Constraint 1: All intermediate calculations must result in positive natural numbers.
Constraint 2: You may only use a source number one time; However, you're not required to use all of the source numbers.

Example: Given source = {2 5 9 12 18 40} and answer = 50. One possible answer is 5 * 18 - 40.

Any takers? =)


Top
  Profile  
 
 Post subject: Re: The Countdown Problemie
PostPosted: Tue Oct 05, 2010 6:27 am 
Java Junkie
Java Junkie
User avatar

Joined: Mon Jun 14, 2004 10:23 am
Posts: 24224
Location: Granite Heaven
Fun! I'll think about this today at work and see if I can drum something up.

Since you don't have to use all of the source numbers, my first pass would be to find the factors of the answer and play with those.


Top
  Profile  
 
 Post subject: Re: The Countdown Problemie
PostPosted: Wed Oct 06, 2010 4:01 am 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
As usual, the brute-force solution is pretty obvious, but I'd really like to come up with a method for finding a minimal length solution quickly (other than using BFS). I keep thinking that a best first search might be pretty good -- not sure though.

I went ahead and watched the rest of the Channel 9 video, which kind of took a turn for the worse. The problem went from finding a single solution to counting all solutions. Fine. Of course, the initial program wasn't fast enough otherwise there wouldn't have been much point in posting the video. Of course, this was exaggerated because the author was trying all permutations of length 6, so he suggested chopping down the search space by not computing the invalid expressions. A pretty obvious todo when using search except he didn't search and called it "program fusion".

He further sped up the program by eliminating equivalent expressions (ie 1*2*3 = 1*3*2 = 2*1*3 = 2*3*1 = 3*1*2 = 3*2*1) , but conveniently neglected to keep the same counting method (ie returning 1 now instead of 6 as before).

Also, I believe his program would have returned 1*2*3 instead of 2*3. Oh well. The problem is still pretty interesting. =)


Top
  Profile  
 
 Post subject: Re: The Countdown Problemie
PostPosted: Thu Oct 14, 2010 5:40 pm 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
Have you thought about it anymore? Just curious, how big of a boat would I need to travel the oceans of this world safely?


Top
  Profile  
 
 Post subject: Re: The Countdown Problemie
PostPosted: Thu Oct 14, 2010 8:16 pm 
Java Junkie
Java Junkie
User avatar

Joined: Mon Jun 14, 2004 10:23 am
Posts: 24224
Location: Granite Heaven
40'+ monohull, 35'+ cat .. assuming you're taking the safest passages across bluewater


Top
  Profile  
 
 Post subject: Re: The Countdown Problemie
PostPosted: Sat Oct 16, 2010 11:51 am 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
If I move back to LA, I'm considering buying a boat and just living in the marina (Marina Del Rey). 40' is a big boat... I'm not sure if I want to Google the slip fee.


Top
  Profile  
 
 Post subject: Re: The Countdown Problemie
PostPosted: Sat Oct 16, 2010 5:42 pm 
Java Junkie
Java Junkie
User avatar

Joined: Mon Jun 14, 2004 10:23 am
Posts: 24224
Location: Granite Heaven
40' is also quite large for someone to single-hand ... if you have a partner, you'll be ok but alone that is a LOT of boat to handle.

Of course, you'd never make a bluewater passage alone .. right? ;)

A liveaboard is a great idea .. I'd look into a cat in that case, though. More than twice the available space for the same beam.


Top
  Profile  
 
 Post subject: Re: The Countdown Problemie
PostPosted: Sat Oct 16, 2010 11:14 pm 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
Jipstyle wrote:
Of course, you'd never make a bluewater passage alone .. right? ;)

What's this?! I thought you were looking forward to ski season!

Jipstyle wrote:
A liveaboard is a great idea .. I'd look into a cat in that case, though. More than twice the available space for the same beam.

I didn't know that... good to know!


Top
  Profile  
 
 Post subject: Re: The Countdown Problemie
PostPosted: Mon Oct 18, 2010 9:04 am 
Java Junkie
Java Junkie
User avatar

Joined: Mon Jun 14, 2004 10:23 am
Posts: 24224
Location: Granite Heaven
Gadget wrote:
Jipstyle wrote:
Of course, you'd never make a bluewater passage alone .. right? ;)

What's this?! I thought you were looking forward to ski season!


:lol:

I wasn't actually offering to come with (though .. woo!) .. just pointing out that any time you leave shore, you have to have someone on watch at all times. The passage from LA to Hawaii, for instance, is over 2000 knots .. given an average speed of 6 knots / hour for a monohull in bluewater (12 for a cat), you're looking at 2 week passage in bluewater. Unless you can stay awake for 2 weeks ... you really need a second hand on board.

Quote:
Jipstyle wrote:
A liveaboard is a great idea .. I'd look into a cat in that case, though. More than twice the available space for the same beam.

I didn't know that... good to know!


Cats are fantastic. Faster, more stable, easier to sail and far more space. Also far more expensive. ;)


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group