in a classroom , the average age of boys ( b ) is g and the average age of girls ( g ) is b . the average age of all is b + g . at the time of calculation , the class teacher , who is 42 years old was also present in the class . can you find the value of b + g ?
a b + g = 8 for b in range ( 199 ) : for g in range ( 199 ) : sum 1 = 2 * b * g + 42 sum 2 = ( b + g ) * ( b + g + 1 ) if ( sum 1 = = sum 2 ) : print ( b , g , sum 1 ) ( b , g ) = ( 35 ) = > b + g = 8
add(divide(subtract(floor(divide(add(sqrt(add(multiply(42, const_4), const_2)), const_1), const_2)), const_1), const_2), divide(subtract(sqrt(subtract(add(multiply(42, const_4), const_2), power(floor(divide(add(sqrt(add(multiply(42, const_4), const_2)), const_1), const_2)), const_2))), const_1), const_2))