A three-digit code for certain logs uses the digits 0,1,2,3,4,5,6,7,8,9, according to the following constraints. The first digit cannot be 0 or 1, the second digit must be 0 or 1, and the second and third digits cannot both be 0 in the same code.How many different codes are possible? 答案是 152
In the first case, (8*1*9), the 2nd digit is assumed to be 0, and therefore, there are 9 possibilities for the third digit (1-9). On top of that, there are 8 possibilities for the first digit, so in the case when the 2nd digit is 0, there are 8*1*9 possible codes.
In the second case, (8*1*10), the 2nd digit is assumed to be 1. In that case, there are 10 possibilities for the 3rd digit (0-9). There are still 8 possibilities for the first digit, so there are 8*1*10 possible codes. The total number of possible codes are the sum of the two cases.