Densest subtree

Write a program that reads non empty binary trees of positive integer
numbers, and for each one prints the greatest average of the elements of
each subtree.

Input

Input starts with m, the number of trees that must be treated. The
description of the m trees follows as it is explained at the exercise
REREC, with an exception: The number of nodes is not given, because you
do not need to store the trees in any vector to solve this exercise. You
can suppose that any of the given trees is empty.

Output

For each tree, your program must print with four decimals the greatest
average of the elements of all its subtrees.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:43:04.599Z

© Jutge.org, 2006–2026.
https://jutge.org
