1094 The Largest Generation (25 分)

WSL2+Docker+Ollama:解锁Windows本地GPU加速运行DeepSeek-R1模型 本文详细介绍了在Windows系统上,通过WSL2、Docker和Ollama的组合方案,实现本地GPU加速运行DeepSeek-R1模型的全过程。该方案解决了Windows环境下Ollama默认无法调用NVIDIA显卡的痛点,通过配置Docker的GPU支持,强制将计算任务分配给GPU,从而显著提升文本生成速度与效率,为开发者提供了一个便捷的本地AI测试环境。 阅读详情

在这里插入图片描述
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 Specification:
Each input file contains one test case. Each case starts with two positive integers N (<100) which is the total number of family members in the tree (and hence assume that all the members are numbered from 01 to N), and M (<N) which is the number of family members who have children. Then M lines follow, each contains the information of a family member in the following format:

ID K ID[1] ID[2] … ID[K]
where ID is a two-digit number representing a family member, K (>0) is the number of his/her children, followed by a sequence of two-digit ID’s of his/her children. For the sake of simplicity, let us fix the root ID to be 01. All the numbers in a line are separated by a space.

Output Specification:
For each test case, print in one line the largest population number and the level of the corresponding generation. It is assumed that such a generation is unique, and the root level is defined to be 1.

Sample Input:
23 13
21 1 23
01 4 03 02 04 05
03 3 06 07 08
06 2 12 13
13 1 21
08 2 15 16
02 2 09 10
11 2 19 20
17 1 22
05 1 11
07 1 14
09 1 17
10 1 18
Sample Output:
9 4

#include<iostream>
#include<vector>
using namespace std;
vector<int> id[100];
int book[100];
void dfs(int N, int depth) {
	book[depth]++;
	for (int i = 0; i < id[N].size(); i++)
		dfs(id[N][i], depth + 1);
}
int main() {
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		int ID, K;
		cin >> ID >> K;
		for (int j = 0; j < K; j++) {
			int temp;
			cin >> temp;
			id[ID].push_back(temp);
		}
	}
	dfs(1, 0);
	int maxnum = 0, maxdepth = 0;
	for (int k = 0; k < 100; k++) {
		if (book[k] > maxnum) {
			maxnum = book[k];
			maxdepth = k;
		}
	}
	cout << maxnum << " " << maxdepth + 1;
	return 0;
}
华中科技大学 计算机组成原理 educoder Logisim平台 计算机数据表示实验 本文主要是对 计算机数据表示实验的笔记和相关Logisim平台的图,供大家学习交流使用。 需要源文件或者源代码,可以留言评论! 目录实验目的第1关:汉字国标码转区位码实验第2关:汉字机内码获取实验第3关:偶校验编码设计第4关:偶校验解码电路设计第5关:16位海明编码电路设计第6关:16位海明解码电路设计第7关:海明编码流水传输实验第8关:16位CRC并行编解码电路设计第9关:CRC编码流水传输实验实验结果: 实验目的 本实训将帮助同学们巩固对计算机中数据表示方法的理解,要求能设计汉字国标码与区位码之间的转换 阅读详情

相关推荐

实践指南——【SPSS操作解析】线性混合效应模型在重复测量数据中的应用

本文详细解析了线性混合效应模型在重复测量数据分析中的应用,并提供了SPSS操作指南。文章阐述了该模型如何通过区分固定效应与随机效应,有效处理数据非独立性和缺失值问题,从而获得更可靠的统计推断。

oo7890的博客 551

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 Specification: Each input file contains one test case.

Little_Small_Joze的博客 270

数据分享|2023年OSM道路数据(全国,分省,分市)

首先这个工作非常有必要的,因为我们正常使用的道路的分类都是基于包括城市快速路、城市主干路、城市次干路这个体系的,大家对于这个分类体系应该更熟悉,但是OSM地图的道路分类又不是完全按这个来的,所以非常有必要重新分类;搞清楚道路类型是我们使用道路数据做很多工作的基础,比如我们在使用道路数据的时候,经常需要预估道路的行车速度,而这个速度一般就是根据道路类型来的,比如高架路的车速肯定就比城市支路快很多!下载分为两种情况,第一种是下载小区域的数据,比如下载一个街区的数据,第二种为下载整个中国范围的。

JData_Engineer的博客 4306

PAT甲级1094 The Largest Generation

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 Specification: Each input file contains one test ca

weixin_44535077的博客 264

dolphinscheduler服务注册中心源码解析(一)服务注册与发现整体设计

下一篇文章我们开始讲解dolphinscheduler基于Zookeeper实现注册中心的源码解析。

最爱嫣夜来 375

【RBF预测】基于粒子群算法优化RBF神经网络实现数据回归预测含Matlab源码

1 简介 原油含水率预测对于确定油井水,油层位以及估计原油产量有着非常重要意义.BP神经网络是最近常用的原油含水率预测方法,然而,由于BP神经网络存在容易陷入局部极小值,收敛速度慢等问题,影响了其预测的实用性和准确性,对此,提出基于粒子群优化RBF神经网络(PSO-RBFNN)的原油含水率预测方法,粒子群优化算法用于RBF神经网络参数优化.在分析原油含水率预测的影响因素基础上,建立粒子群优化RBF神经网络的原油含水率预测模型.实验结果表明,在原油含水率预测中,基于粒子群优化RBF神经网络比BP神经网络有着

qq_59747472的博客 1234

PAT 1094 The Largest Generation (25 分) dfs or bfs

#include <iostream> #include <vector> using namespace std; vector<vector<int>>v; int book[100]={0},num=0,maxlevel; void dfs(int index,int level){ if(++book[level]>num) { maxlevel=level; num=book[level]; }

m0_48711099的博客 402

YOLOv5改进 | 低照度检测 | 2024最新改进CPA-Enhancer链式思考网络(适用低照度、图像去雾、雨天、雪天)

本文给大家带来的2024.3月份最新改进机制,由CPA-Enhancer: Chain-of-Thought Prompted Adaptive Enhancer for Object Detection under Unknown Degradations论文提出的CPA-Enhancer链式思考网络CPA-Enhancer通过引入链式思考提示机制,实现了对未知退化条件下图像的自适应增强。该方法的核心在于能够利用CoT提示对图像退化进行动态分析和适应,从而显著提升物体检测性能。

Snu77的博客 2222

PAT甲级 1094 The Largest Generation DFS 找到结点数目最多的一层

Solution: 题目大意:给出一棵树,有n个结点(1~n),其中1为根结点,m个非叶子结点。求出结点数最多的一层,输出这个结点数以及是第几层。 先DFS得到树的最大层数。再遍历每一层得到每一层的结点数。最后找到最大的那一层即可。 代码如下: //树的层次遍历 找到结点数目最多的一层 #include<iostream> #include<vector> #inclu...

化身孤岛的鲸o的博客 553

基于STM32L4XX、HAL库的CH182H1以太网收发器(PHY)驱动程序设计

define PHY_REG_PHYSCR 0x12 // PHY特殊控制寄存器。#define PHY_REG_PHYSTS 0x10 // PHY状态寄存器。#define PHY_REG_PHYIDR 0x11 // PHY标识寄存器。#define PHY_REG_ID1 0x02 // PHY标识符1。#define PHY_REG_ID2 0x03 // PHY标识符2。

zhusl6688的博客 405

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

1094 The Largest Generation(25 分)

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 w...

Become hunger become strong 772

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

PTA甲级1094 The Largest Generation (25分)

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 generati...

p1967914901的博客 315

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

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 ...

AixsCode 580

1094 The Largest Generation (25 分)

1094The 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 ...

chen_zan_yu_的博客 134

【1094】The Largest Generation (25 分)

#include<iostream> #include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> #include<algorithm> #include<map> #include<vector> #inclu...

发现问题,并解决问题,批判性思维 499
上一篇: 1106 Lowest Price in Supply Chain (25 分)
下一篇: 1090 Highest Price in Supply Chain (25 分)
好想当依蕾娜小姐的狗
博客等级 码龄7年 0粉丝 62原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值