[LRUG] Puzzle

Matthew Rudy Jacobs matthewrudyjacobs at gmail.com
Thu Feb 10 22:51:05 PST 2011


one of these photo sets is longer

WLOG we'll say urban has more (9)
while nature has less (6)

urban photos: U = [u1, u2, ... u6, ..., u9]
nature photos N = [n1, n2, ... n6]

we define an ordering on these

[u1,n1], [u2,n2], [u3,n3], [u4,n4], [u5,n5], [u6,n6], [u7,n1], [u8,n2],
[u9,n3]
[u1,n2],[u2,n3], ...                      [u5,n6], [u6,n1], ...
        [u9,n4]
[u1,n3],....

namely we cycle over [u(i), n(i)]
when we run out of ns with start n from the beginning

then we shift the index on the ns

[u(i), n(i+1)]
....

boom!

this is uniform when you have enough.

On 10 February 2011 19:21, Andrew Stewart <boss at airbladesoftware.com> wrote:

> Hola El Rug,
>
> Here's a little teaser for you...
>
> I have two sets of photos; we'll call them urban and nature.  Both sets
> contain about 6-9 photos, but not necessarily the same number.
>
> I also have about 15-20 pages on a site, spread more or less evenly across
> three sections.  Each page has a title unique to its section (and, if it
> helps, we can assume unique across all the pages).
>
> On each page I want to display one photo from each set.
>
> The constraints in descending order are:
>
> * The code should change as little as possible when I add or remove a page
> or photo.
> * We should use each photo at least once.
> * A combination of [urban photo, nature photo] should not appear on more
> than one page.
> * And we should try to use all the photos roughly uniformly.
>
> Your time starts...now!
>
> Yours,
> Andy Stewart
>
> -------
> http://airbladesoftware.com
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20110211/f618e620/attachment-0003.html>


More information about the Chat mailing list