Assuming they work until their cost become the same, obviously.
The difference between the first charge of painter A and painter B = 376 - 280 = 96.
The hourly cost difference between painter B and painter A = 15 - 12 = 3.
So, painter A in the first hour has 96 more dollars than painter B, and as every hour pass, the difference goes down by 3 (as painter B gets 3 more dollars every hour)
Therefore, it would take 96 : 3 = 32 hours for the cost to be the same
Recheck : After 32 hours, painter A has 376 + 32 x 12 = 760 (dollars) painter B has : 280 + 15 x 32 = 760 (dollars)