Problem

Source: 2018 Argentina L2 P6

Tags: combinatorics



Ana writes a three-digit code, and Beto has to guess it. To do so, he can ask about a sequence of three digits, and Ana will respond "warm" if the sequence Beto proposes has at least one correct digit in the correct position, and she will respond "cold" if none of the digits are correct. For example, if the correct code is $014$, then if Beto asks $099$ or $014$, he receives the answer "warm", and if he asks $140$ or $322$, he receives the answer "cold". Determine the minimum number of questions Beto needs to ask in order to know the correct code with certainty.