The problem: —– By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23. 3 7 4 2 4 6 8 5 9 3 That is, 3 + 7 + 4 + 9 = 23. Find the maximum total [...]
Solution to Problem 17 on ProjectEuler.net
The problem: ——- If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many [...]
Google Code Jam 2013: Round 1B Problam A
Armin is playing Osmos, a physics-based puzzle game developed by Hemisphere Games. In this game, he plays a “mote”, moving around and absorbing smaller motes. A “mote” in English is a small particle. In this game, it’s a thing that absorbs (or is absorbed by) other things! The game in this problem has a similar [...]
Google Code Jam 2013 – Round 1A Problem B
You’ve got a very busy calendar today, full of important stuff to do. You worked hard to prepare and make sure all the activities don’t overlap. Now it’s morning, and you’re worried that despite all of your enthusiasm, you won’t have the energy to do all of this with full engagement. You will have to [...]
Google Code Jam 2013 – Round 1A Problem A
Maria has been hired by the Ghastly Chemicals Junkies (GCJ) company to help them manufacture bullseyes. A bullseye consists of a number of concentric rings (rings that are centered at the same point), and it usually represents an archery target. GCJ is interested in manufacturing black-and-white bullseyes. Maria starts with t millilitres of black paint, [...]
Printing in Binary Form – ARM Assembly
When programming in assembly there are many occasions where you need to examine the bits at a particular register or memory address. Printf doesn’t offer the option to print in binary form, so you need to create your own function if you want to do that. Here’s one that will do just that. It prints [...]
Optimizing for Speed with ARM Assembly
You probably already heard that if you want to squeeze every last cycle of performance from your programs you need to be able to tweak them in assembly, right? Well, unless you know what you are doing jumping into assembly won’t help, and in some cases it might even hurt. As I started playing around [...]
Google Code Jam 2013 – Qualification Round Problem 3
Little John likes palindromes, and thinks them to be fair (which is a fancy word for nice). A palindrome is just an integer that reads the same backwards and forwards – so 6, 11 and 121 are all palindromes, while 10, 12, 223 and 2244 are not (even though 010=10, we don’t consider leading zeroes [...]
Google Code Jam 2013 – Qualification Round Problem 2
Alice and Bob have a lawn in front of their house, shaped like an N metre by M metre rectangle. Each year, they try to cut the lawn in some interesting pattern. They used to do their cutting with shears, which was very time-consuming; but now they have a new automatic lawnmower with multiple settings, [...]
Google Code Jam 2013 – Qualification Round Problem 1
Tic-Tac-Toe-Tomek is a game played on a 4 x 4 square board. The board starts empty, except that a single ‘T’ symbol may appear in one of the 16 squares. There are two players: X and O. They take turns to make moves, with X starting. In each move a player puts her symbol in [...]