-->
当前位置:首页 > 题库

PROGRAMMING:domestic premises

Luz5年前 (2021-05-10)题库385
Given each person's family members and their own real estate, please count the population, per capita real estate area and the number of real estate units of each family.
###Input format:
Enter the first line to give a positive integer $$n $$($$Le 1000 $$), followed by $$n $$lines, each of which gives a person's property in the following format:
```
No. parents K children 1... Children K total area of real estate
```
The number is a unique 4-digit number for each person` Father and mother are the number of the person's parents corresponding to the number (if they have passed away, '- 1' will be displayed)` K '($$0 / Le $$$k' $$Le 5 $$) is the number of the person's children` Child I 'is the number of the child.
###Output format:
First, output the number of families in the first line (all related people belong to the same family). Then output the information of each family in the following format:
```
Minimum number of family members family population per capita housing units per capita housing area
```
The per capita value is required to keep 3 decimal places. Firstly, the family information is output in descending order of per capita area, and if there are parallels, it is output in ascending order of member number.
###Input example:
```in
ten
6666 5551 5552 1 7777 1 100
1234 5678 9012 1 0002 2 300
8888 -1 -1 0 1 1000
2468 0001 0004 1 2222 1 500
7777 6666 -1 0 2 300
3721 -1 -1 1 2333 2 150
9012 -1 -1 3 1236 1235 1234 1 100
1235 5678 9012 0 1 50
2222 1236 2468 2 6661 6662 1 300
2333 -1 3721 3 6661 6662 6663 1 100
```
###Output example:
```out
three
8888 1 1.000 1000.000
0001 15 0.600 100.000
5551 4 0.750 100.000
```






answer:If there is no answer, please comment