PAT 1114 Family Property】的更多相关文章

1114 Family Property(25 分) This time, you are supposed to help us collect the data for family-owned property. Given each person's family members, and the estate(房产)info under his/her own name, we need to know the size of each family, and the average…
This time, you are supposed to help us collect the data for family-owned property. Given each person's family members, and the estate(房产)info under his/her own name, we need to know the size of each family, and the average area and number of sets of…
PAT甲级1114. Family Property 题意: 这一次,你应该帮我们收集家族财产的数据.鉴于每个人的家庭成员和他/她自己的名字的房地产(房产)信息,我们需要知道每个家庭的规模,以及他们的房地产的平均面积和数量. 输入规格: 每个输入文件包含一个测试用例.对于每种情况, 第一行给出正整数N(<= 1000).然后N行跟随,每个给出一个拥有庄园的人的信息,格式如下: ID父亲母亲k Child1 ... Childk M_estate Area 其中ID是每个人唯一的4位数识别号码;父…
此文章同步发布在我的CSDN上https://blog.csdn.net/weixin_44385565/article/details/89930332 1114 Family Property (25 分) This time, you are supposed to help us collect the data for family-owned property. Given each person's family members, and the estate(房产)info un…
1114 Family Property (25 分) This time, you are supposed to help us collect the data for family-owned property. Given each person's family members, and the estate(房产)info under his/her own name, we need to know the size of each family, and the average…
简单DFS. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #include<map> #include<queue> #include<stack> #include<algorithm> using namespace std; struct X { int id; int Father,Mother; int k;…
题意:给出每个人的家庭成员信息和自己的房产个数与房产总面积,让你统计出每个家庭的人口数.人均房产个数和人均房产面积.第一行输出家庭个数,随后每行输出家庭成员的最小编号.家庭人口数.人均房产个数.人均房产面积. 并查集,合并的时候编号小的作为父亲节点,最后父亲节点一样的即属于一个家庭,其它都是细节处理没啥好说了. #include <iostream> #include <cstdio> #include <algorithm> #include <string.h…
题意: 输入一个正整数N(<=10000),接着输入N行每行包括一个人的ID和他双亲的ID以及他的孩子数量和孩子们的ID(四位整数包含前导零),还有他所拥有的房产数量和房产面积.输出一共有多少个块(所有有父子关系的点都视为处于同一块),以及每块的元素个数以及平均每人分得的房产数量和房产面积(保留三位小数),输出顺序按照房产面积降序,第二优先以ID升序. AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h&…
This time, you are supposed to help us collect the data for family-owned property. Given each person's family members, and the estate(房产)info under his/her own name, we need to know the size of each family, and the average area and number of sets of…
用并查集处理每个家庭的信息,注意标记~ #include<bits/stdc++.h> using namespace std; ; bool visit[maxn]={false}; int N; struct node { int id; ]; double num; double area; }Node[maxn]; struct family { int id; double num; double area; int renshu; }f[maxn]; int father[maxn…