# 5. Variant 1

Given nine cards with the numbers $5,5,6,6,6,7,8,8,9$ written on them. From these cards, three three-digit numbers $A$, B, V were formed, each of which has all three digits different. What is the smallest value that the expression A + B - V can have?
Answer: 149.

Solution. By forming the smallest sum of numbers A and B, as well as the largest number C, we get the smallest value of the expression A + B - C: $566 + 567 - 988 = 145$. However, this combination is not suitable: two numbers have the same digits. By swapping the digits 6 and 8 in the units place, we get the required combination: $568 + 567 - 986 = 149$. Why is this combination the best? With any other arrangement of digits in the hundreds place, we will get a contribution from the hundreds equal to 200, or $300, \ldots$. And in the tens and units places, we will get positive values, as the sum of any two of the digits is greater than any third digit. Therefore, the number A + B - C will be greater than 200. Thus, A and B start with the digit 5, and C starts with the digit 9. Similarly, we get that the second digits of numbers A and B should be 6, and the second digit of number C should be 8. The units place has been discussed above.

## Variant 2

Given nine cards with the numbers $5,5,6,6,7,7,8,8,9$ written on them. From these cards, three three-digit numbers A, B, C were formed, each of which has all three digits different. What is the smallest value that the expression A + B - C can take?

Answer: 148.

## Variant 3

Given nine cards with the numbers $4,4,5,5,5,6,7,7,8$ written on them. From these cards, three three-digit numbers A, B, C were formed, each of which has all three digits different. What is the smallest value that the expression A + B - C can take?

Answer: 38.

## Variant 4

Given nine cards with the numbers $4,4,5,5,6,6,7,7,8$ written on them. From these cards, three three-digit numbers A, B, C were formed, each of which has all three digits different. What is the smallest value that the expression A + B - C can take?

Answer: 37.

## Variant 5

Given nine cards with the numbers $5,5,6,6,6,7,7,8,9$ written on them. From these cards, three three-digit numbers A, B, C were formed, each of which has all three digits different. What is the smallest value that the expression A + B - C can take?

Answer: 148.