.
First of all, it is clear that Bob's earning is monotonic function of the number of books sold.
Let consider some values.
If the number of books is 100, then he gets
12*100 = 1200 dollars counting $12 for each single book, PLUS
5*(100/10) = 5*10 = 50 dollars counting $5 for every 10 sold books, PLUS
50*(100/100) = 50*1 = 50 dollars counting $50 for every 100 sold books,
which gives the TOTAL 1200 + 50 + 50 = 1300 dollars.
If the number of books is 101, then he gets
12*101 = 1212 dollars counting $12 for each single book, PLUS
5*int(101/10) = 5*10 = 50 dollars counting $5 for every 10 sold books, PLUS
50*int(101/100) = 50*1 = 50 dollars counting $50 for every 100 sold books,
which gives the TOTAL 1212 + 50 + 50 = 1312 dollars.
If the number of books is 102, then he gets
12*102 = 1224 dollars counting $12 for each single book, PLUS
5*int(102/10) = 5*10 = 50 dollars counting $5 for every 10 sold books, PLUS
50*int(100/100) = 50*1 = 50 dollars counting $50 for every 100 sold books,
which gives the TOTAL 1224 + 50 + 50 = 1324 dollars.
In this solution, the expression int(x) denotes the function "whole part of the number x".
So, if x is the number of the sold books, then Bob's earning is
Earning(x) = 12*x + 5*int(x/10) + 50*int(x/100).
With this formula, we can calculate further for n = 103, 104, 105, 106
Earning(103) = 12*103 + 5*int(103/10) + 50*int(103/100) = 12*103 + 5*10 + 50*1 = 1336,
Earning(104) = 12*104 + 5*int(104/10) + 50*int(104/100) = 12*104 + 5*10 + 50*1 = 1348,
Earning(105) = 12*105 + 5*int(105/10) + 50*int(105/100) = 12*105 + 5*10 + 50*1 = 1360,
Earning(106) = 12*106 + 5*int(106/10) + 50*int(106/100) = 12*106 + 5*10 + 50*1 = 1372.
In this way, we get the ANSWER: 106 books should be sold.
The solution is completed.