×
Computer Science

# Computer Science Warmups: Level 3 Challenges

The Ackermann function is a computable function which grows very, very quickly as its inputs grow. For example, while $$A(1,2),$$ $$A (2,2),$$ and $$A(3,2)$$ are equal to $$4,7,$$ and $$29,$$ respectively, $$A(4,2) \approx 2 \times 10^{19728}$$.

The Ackermann function can be defined as follows: $A(m,n) = \begin{cases} n+1 & \mbox{if } m = 0 \\ A(m-1, 1) & \mbox{if } m > 0 \mbox{ and } n = 0 \\ A(m-1, A(m, n-1)) & \mbox{if } m > 0 \mbox{ and } n > 0. \end{cases}$

What is the value of $$A(3,6)?$$

Tom and Gina are going hiking in the desert, and Tom is responsible for carrying as much water as he can with him. Unfortunately, however, he has only a few fixed sizes of water bottles into which he can put the water, and he can only carry 15.00 kg at most.

If his bottles have the following masses, and he can carry as many of each as he likes (so long as the total is less than or equal to 15 kg), what is the most amount of water that Tom can carry?

• Tiny: 0.77 kg
• Small: 1.10 kg
• Medium: 3.4 kg
• Large: 7 kg

Compute the number of paths from S (start) to G (goal) in the following image, without using any road twice (but may visit an intersection twice). As an explicit example, the path in pink is one valid path.

Clarifications:

• A road is a segment between two intersections that doesn't include any other intersection. A path is a connected sequence of roads from start to goal.

Out of the $$362880$$ ways of arranging the numbers

$1,2,3,4,5,6,7,8,9$

in a $$3 \times 3$$ matrix, how many configurations are there such that all lines (rows, columns and diagonals) add up to the same sum?

Suppose you have a $$1\times 1$$ square. If two points are randomly picked within the square, what is the expected value (average) of the distance between them, rounded to 4 decimal places?

×