# How the hell do you solve this?

## Recommended Posts

Question 3 ^

I've gotta do this olympiad some time in the next week. Can't get my head around how to do question 3 from this past paper. I can brute force it, but it'd take forever..Especially with the ones that require a hell of a lot of steps.

Any ideas?

##### Share on other sites

what kind of shit is this? logic building? lol #brainhurt

##### Share on other sites

Hell nah I aint readin dat!

##### Share on other sites

Well I'd start by looking at what numbers between 100,000 and 999,999 don't repeat any digits, and then figure out if those are "anagram numbers".

The amount of numbers that don't repeat digits in that range are:

9*9*8*7*6*5 = 136080.

So you have 136080 numbers between 102,345 and 987,654 that don't repeat a digit. Then to check if they're anagram numbers, you have to do *at most* 8 multiplications of those numbers by a single digit 2 through 9. Lets say it takes 6 tries on average (assuming most numbers aren't anagram numbers). That's still only ~600,000 multiplications you have to do, which any modern-day computer could do very quickly.

Edit: OH LOL I WAS LOOKING AT Q1 PART 3

Edited by Toph
##### Share on other sites

Question 3....I know how to do the other questions

• 1
##### Share on other sites

Ooh Lionhead studios, they make Fable! Awesome game devs!

##### Share on other sites

I have been mind blown before, but this is off the charts.

• 1
##### Share on other sites

Looks like you could use a directed graph with each edge having a weight. Then compute the shortest path to a node T containing the total flow that you want to have, and that path would be the steps needed to get to T capacity. Not sure, im trying to study for my finals also, so just briefly skimmed over it. :P