题目 A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation with the largest population. Input Specification: Each input file contains one test…
PTA甲级1094 The Largest Generation (25分) A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation with the largest population. Input Specificatio…
1094. The Largest Generation (25) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find…
http://www.patest.cn/contests/pat-a-practise/1094 A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation with the largest population. Input S…
#include<bits/stdc++.h>using namespace std;int n,m,l,t;int a[1307][137][67];int vis[1307][137][67];typedef struct{    int x,y,z;}node;int xx[6]={0,0,0,0,1,-1};int yy[6]={0,0,1,-1,0,0};int zz[6]={1,-1,0,0,0,0};node p;int bfs(int x,int y,int z){    qu…
题意: 输入两个正整数N和M(N<100,M<N),表示结点数量和有孩子结点的结点数量,输出拥有结点最多的层的结点数量和层号(根节点为01,层数为1,层号向下递增). AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; vector<]; ]; void dfs(int x,int storey){ ++ans[storey]; for(aut…
简单DFS. #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<map> #include<queue> #include<stack> #include<vector> using namespace std; ; int n,m; vector<int>g[maxn]; int ans[…
题目如下: #include<iostream> #include<vector> #include<algorithm> using namespace std; int book[100]; vector<int> vi[100]; void dfs(int index, int level){ book[level]++;//第一层肯定是有的,即根节点 for(int i = 0; i < vi[index].size(); i++){ dfs(…
A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation with the largest population. Input Specification: Each input file contains one test ca…
At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in's and out's, you are supposed to find the ones who have unlocked a…