Enigmatic Code

Programming Enigma Puzzles

Enigma 1585: Diving points

From New Scientist #2750, 6th March 2010 [link]

In international diving, the judges’ score for the dive is multiplied by a tariff that represents the degree of difficulty of the dive to give the points awarded for the dive. The judges’ score can be any integer divisible by 5 up to a maximum of 300. The tariff can be any integer between 20 and 38.

On this dive the nine digits that appeared in the judges’ score, the tariff and the points awarded were all different.

How many points were awarded for the dive?



One response to “Enigma 1585: Diving points

  1. jimrandell 30 January 2012 at 7:39 pm

    The following Python code runs in 41ms.

    from enigma import irange, printf
    for score in irange(0, 300, step=5):
      for tariff in irange(20, 38):
        points = score * tariff
        string = ''.join(map(str, (score, tariff, points)))
        if len(string) != 9: continue
        if len(set(list(string))) != 9: continue
        printf("{score} x {tariff} = {points}")

    Solution: 6290 points were awarded.

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: