Found problems: 63
2016 CMIMC, 3
Let $\varepsilon$ denote the empty string. Given a pair of strings $(A,B)\in\{0,1,2\}^*\times\{0,1\}^*$, we are allowed the following operations:
\[\begin{cases}
(A,1)\to(A0,\varepsilon)\\
(A,10)\to(A00,\varepsilon)\\
(A,0B)\to(A0,B)\\
(A,11B)\to(A01,B)\\
(A,100B)\to(A0012,1B)\\
(A,101B)\to(A00122,10B)
\end{cases}\]
We perform these operations on $(A,B)$ until we can no longer perform any of them. We then iteratively delete any instance of $20$ in $A$ and replace any instance of $21$ with $1$ until there are no such substrings remaining. Among all binary strings $X$ of size $9$, how many different possible outcomes are there for this process performed on $(\varepsilon,X)$?
2017 CMIMC Computer Science, 1
What is the minimum number of times you have to take your pencil off the paper to draw the following figure (the dots are for decoration)? You must lift your pencil off the paper after you're done, and this is included in the number of times you take your pencil off the paper. You're not allowed to draw over an edge twice.
[center][img]http://i.imgur.com/CBGmPmv.png[/img][/center]
2017 CMIMC Individual Finals, 1
Cody has an unfair coin that flips heads with probability either $\tfrac13$ or $\tfrac23$, but he doesn't know which one it is. Using this coin, what is the fewest number of independent flips needed to simulate a coin that he knows will flip heads with probability $\tfrac13$?
2025 CMIMC Combo/CS, 1
Robert has five beads in his hand, with the letters $C, M, I, M,$ and $C,$ and he wants to make a circular bracelet spelling "$CMIMC.$" However, the power went out, so Robert can no longer see the beads in his hand. Thus, he puts the five beads on the bracelet randomly, hoping that the bracelet, when possibly rotated or flipped, spells out "$CMIMC.$" What is the probability that this happens? (Robert doesn’t care whether some letters appear upside down or backwards.)
2020 CMIMC Combinatorics & Computer Science, 5
Seven cards numbered $1$ through $7$ lay stacked in a pile in ascending order from top to bottom ($1$ on top, $7$ on bottom). A shuffle involves picking a random card [i]of the six not currently on top[/i], and putting it on top. The relative order of all the other cards remains unchanged. Find the probability that, after $10$ shuffles, $6$ is higher in the pile than $3$.
2017 CMIMC Computer Science, 5
Given a list $A$ of $n$ real numbers, the following algorithm, known as $\textit{insertion sort}$, sorts the elements of $A$ from least to greatest.
\begin{tabular}{l}
1: \textbf{FUNCTION} $IS(A)$ \\
2: $\quad$ \textbf{FOR} $i=0,\ldots, n-1$: \\
3: $\quad\quad$ $j \leftarrow i$\\
4: $\quad\quad$ \textbf{WHILE} $j>0$ \& $A[j-1]>A[j]:$\\
5: $\quad\quad\quad$ \textbf{SWAP} $A[j], A[j-1]$\\
6: $\quad\quad\quad$ $j \leftarrow j-1$\\
7: \textbf{RETURN} $A$
\end{tabular}
As $A$ ranges over all permutations of $\{1, 2, \ldots, n\}$, let $f(n)$ denote the expected number of comparisons (i.e., checking which of two elements is greater) that need to be made when sorting $A$ with insertion sort. Evaluate $f(13) - f(12)$.
2025 CMIMC Combo/CS, 7
Alan is bored one day and decides to write down all the divisors of $1260^2$ on a wall. After writing down all of them, he realizes he wrote them on the wrong wall and needs to erase all his work. Every second, he picks a random divisor which is still on the wall and instantly erases it and every number that divides it. What is the expected time it takes for Alan to erase everything on the wall?
2019 CMIMC, 7
Consider the set $L$ of binary strings of length less than or equal to $9$, and for a string $w$ define $w^{+}$ to be the set $\{w,w^2,w^3,\ldots\}$ where $w^k$ represents $w$ concatenated to itself $k$ times. How many ways are there to pick an ordered pair of (not necessarily distinct) elements $x,y\in L$ such that $x^{+}\cap y^{+}\neq \varnothing$?
2018 CMIMC CS, 10
Consider an undirected, connected graph $G$ with vertex set $\{v_1,v_2,\ldots, v_6\}$. Starting at the vertex $v_1$, an ant uses a DFS algorithm to traverse through $G$ under the condition that if there are multiple unvisited neighbors of some vertex, the ant chooses the $v_i$ with smallest $i$. How many possible graphs $G$ are there satisfying the following property: for each $1\leq i\leq 6$, the vertex $v_i$ is the $i^{\text{th}}$ new vertex the ant traverses?
2017 CMIMC Computer Science, 6
Define a self-balanced tree to be a tree such that for any node, the size of the left subtree is within 1 of the size of the right subtree. How many balanced trees are there of size 2046?
2025 CMIMC Combo/CS, 10
Let $a_n$ be the number of ways to express $n$ as an ordered sum of powers of $3.$ For example $a_4=3,$ since $$4=1+1+1+1=1+3=3+1.$$ Let $b_n$ denote the remainder upon dividing $a_n$ by $3.$ Evaluate $$\sum_{n=1}^{3^{2025}} b_n.$$
2025 CMIMC Combo/CS, 2
Every day, Pinky the flamingo eats either $1$ or $2$ shrimp, each with equal probability. Once Pinky has consumed $10$ or more shrimp in total, its skin will turn pink. Once Pinky has consumed $11$ or more shrimp in total, it will get sick. What is the probability that Pinky does not get sick on the day its skin turns pink?
2020 CMIMC Combinatorics & Computer Science, Estimation
Max flips $2020$ fair coins. Let the probability that there are at most $505$ heads be $p$. Estimate $-\log_2(p)$ to 5 decimal places, in the form $x.abcde$ where $x$ is a positive integer and $a, b, c, d, e$ are decimal digits.