Professional Documents
Culture Documents
Instructions
➔ Time limit for the event is two hours. Reached the venue late? Nope, no
extra time for you.
➔ There are four problems in this paper. No, they are NOT questions.
They are problems, because you'll have to sweat it out to solve them.
➔ The questions problems are NOT arranged in the order of difficulty.
That's for you to figure out.
➔ When you think you've solve a problem correctly, raise BOTH of your
hands and shout out "I'm a carrot!". Anyone who does not follow this
rule will get minus 30 points for being a disobedient little brat.
➔ For each correct attempt you get 100 points. However, you need to
watch out because for each incorrect attempt you get minus 50 points.
➔ In case of a tie in scores among different teams, the time taken to
attempt the problems will be considered.
➔ Be scared. Be very very scared indeed.
www.code-warriors.org
DNA. Nothing to do with Douglas Noel Adams.
Thankfully.
After the excessive dose of Douglas Noel Adams (aka DNA) in Code Wars 2007,
we perfectly understand if some of you feel paranoid about coming across
those three letters in that permutation. We decided to give something you'd
surely hate equally – biology.
A DNA (deoxyribonucleic acid – remember it, the guy who comes to check your
program might ask you this) molecule is formed by two nucleotide chains of
equal length. Each nucleotide in the first chain must form a bond with the
nucleotide at the same position in the second chain. There are four types of
nucleotides: A, C, G and T. Each type of nucleotide can only form a bond with
one other type: A can only bond with T, and G can only bond with C. These
pairs – AT and CG – are called complementary pairs. No other bonds are
allowed.
Examples
1. AGGCA returns 1.
2. GGTACAGTTT returns 3.
3. ACCACCAACCA returns 0.
www.code-warriors.org
Persian Clock. Made of gold, obviously.
You bought a golden Persian digital wall clock, but while hanging it on the wall,
you mounted it upside-down by mistake (obviously, because you're stupid). To
make things worse, the clock has a complicated mechanism inside that makes
it go slow when it is upside-down (just to make you feel miserable), needing X
seconds (an integer value between 61 and 1000, inclusive) to advance a
minute instead of 60 seconds. Note that even at the moment you hang the
clock on the wall, it is not necessarily set at the correct time. The clock itself
only displays hours (from 00 to 23) and minutes (from 00 to 59), including any
leading zeros.
When the clock time is read upside-down, the digits 0, 1, 2, 5 and 8 are the
same, 6 is shown as 9 and 9 is shown as 6. The digits 3, 4 and 7 do not show
any meaningful digits when read upside-down.
Examples
www.code-warriors.org
Chandra Yawn – The Space Race
Examples
www.code-warriors.org
Gridlock'd
In each move, you choose any single cell (R, C) in the grid (R-th row, C-th
column) and flip the coins in all cells (r, c), where r is between 0 and R,
inclusive, and c is between 0 and C, inclusive. Flipping a coin means inverting
the value of a cell from zero to one and vice versa. Here we would like to pre-
empt those trying act smart by asking "But what if when I flip a coin the result
is neither head or tail?" by saying this: this is Sparta Code Wars 2008, not
bloody Sholay.
Return the minimum number of moves required to change all the cells in the
grid to tails. This will always be possible – unless of course you don't have the
brains to do it.
Examples
1. 1111
1111
returns: 1
2. 01
01
returns: 2
www.code-warriors.org