The largest possible value is 41, it is obtained (for example) when a=b=21 and c=0.
First rewrite the expression:
a2b+ab2+b2c+bc2+a2c+ac2=ab(1−c)+bc(1−a)+ac(1−b)=ab+bc+ac−3abc=ab(1−3c)+c(1−c).
Assume that a≥b≥c, then c≤31 and therefore (1−3c)≥0. If c is fixed then a+b also is fixed and as the value of the expression is maximal when ab is maximal then a=b=21−c.
Then the expression can be rewritten as:
ab(1−3c)+c(1−c)=(21−c)2(1−3c)+c(1−c)=41−c(1+3c2)=41(1−3c((c−21)2+121))≤41.