Ace feels like the current 4 digit passcode system is flawed, because if you enter an incorrect passcode, it doesn't tell you you're wrong when you first enter an incorrect digit, but rather when you have attempted the entire passcode, meaning that if the first, second, or third digit was incorrect, entering more digits is just a waste of time, since you will inevitably get the passcode wrong.
So, Ace decides to make a simpler 4 digit passcode system. Whenever you enter a digit for a passcode, if the digit is correct, it will appear. Otherwise, everything you have entered so far will automatically clear (nothing will happen if you get the first digit wrong). For example, suppose the passcode is 5718. If you enter 5, it will appear because the first digit is 5. If you then enter a 7, it will also appear because the second digit is 7. If you enter a 0 next, the passcode will clear immediately because the third digit is actually a 1.
To a logical person, it will take at most 10,000 tries to guess a passcode correctly if using the normal 4 digit passcode system, since there are 10,000 possible passcodes, and incorrect attempts will be remembered.
Ace claims that using his system, it will still take at most 10,000 tries, because there are still 10,000 possible passcodes. To a logical person, at most how many tries will it take?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
To find the maximum number of tries it will take, we need to consider the worst case scenario. Let's suppose the passcode is 9999 and a guesser starts from 0 and goes up by 1 each time for each digit.
For the first digit, he enters 0. Nothing happens, telling him that the first digit isn't 0. Next, he tries 1, and then goes all the way up to 8, to which nothing happens every single time. 9 tries so far.
On the tenth try, he correctly enters 9 for the first digit, and then tries 0 for the second. The 9 disappears, telling the guesser the second digit isn't 0, so he goes up all the way to 8 for the second digit. 18 tries so far.
For each digit, it takes 9 tries to get from 0 to 8, and since there are 4 digits, it takes 36 tries in all. However, on the 36th try, the guesser is at 9998, and needs one more try to get to 9999, for a total of 3 7 tries.