Golfscript, 19 18 17 13 bytes
~.,\{\)%!}+,,
How it works
~ Evaluate the input, n
., Duplicate the input, create array [0..n-1]
\ Swap array and n
{ }+ Add n to block == {n block}
\ Swap n with i in array
) Increme...
Well, there is the idea that there could be more than one 3x10 arrays that are optimal for N=10, but they don't all lead to the optimal arrays for 3x11
@MartinBüttner I might misunderstood what you want, but the proof is simply that no other columns than the last two can make a 3-in-a-row when you add the next column to the grid, so you should use the grid with the most 1's from the ones which have the same last two column
@randomra The grid with the most 1s from the previous solution might not permit adding any 1s, wheras a suboptimal grid with one or two 1s less might permit adding one or two 1s.
Challenge
Make an error-checker in the least amount of possible bytes! If you received an HTML program as a string through standard input, your program will be able to find all the errors and return to standard output. If the program is over 2000 characters, return that as an error too.
Scoring...
You are given an arbitrarily large grid, where each square can either be off or on (think Game-of-life type board).
You need to tile such a grid to maximize the number of "on" squares without there being any 3-in-a-row of "on" squares. A 3-in-a-row can be horizontal, vertical, or diagonal. 3-i...
you've proven that in the entire plane, no 3x6 segment can contain more than 10 ones
so the average in the entire plane can't be higher than 5/9
the only thing the tiling of the horizontal strip gives us beyond that, is the fact that we can stop examining the 3xN strip because it won't lower the bound any further.
because if the average in the entire plane was (5+delta)/9, there would have to be 3x6 segments with 11 tiles, or otherwise the average would be <= 10/18
Note: I think the question is fine. I just need some more testcases for it.
You are given the priority order of alleles for a particular trait. For example,
A B
O
means that A and B are equally dominant and O is recessive to both of them. An organism has exactly two alleles, but only the ...
You are given an arbitrarily large grid, where each square can either be off or on (think Game-of-life type board).
You need to tile such a grid to maximize the number of "on" squares without there being any 3-in-a-row of "on" squares. A 3-in-a-row can be horizontal, vertical, or diagonal. 3-i...
dary!
In events entirely unrelated to what will hopefully happen to me in the next couple of days, I task you to write code that does the following:
Print
Legen... wait for it...
immediately, with a trailing newline.
Wait until the next full hour (when the cron job for awarding the badge ru...
You would select a random permutation of BCAD (excluding BCAD itself) for the next row. For the row after that, you select another random permutation, this time excluding BCAD and the one you just made.