资源简介
包含题目、数据、代码。
代码片段和文件信息
#include
#include
using namespace std;
int main()
{
//freopen(“1.txt““r“stdin);
//freopen(“2.txt““w“stdout);
int T;
scanf(“%d“&T);
while(T--){
int nmpqxy;
scanf(“%d%d%d%d“&n&m&p&q);
//节点数据不会大于1w,利用数组下标
//a[][0] 存储父亲
//a[][1] a[][2] 分别存储左右孩子
//这里初始值为0,说明为空
int a[100000][3]={0};
for(int i=0;i scanf(“%d%d“&x&y);
//一个孩子也没有
if(a[x][1]==0) a[x][1]=y;
else a[x][2]=y;
a[y][0]=x;
}
int judge[100000]={0};
int ans=0;
while(1){
//p和q两个节点的深度不同,当其中一个退到根节点,就不用再操作了
if(a[p][0]!=0){ //有父亲
judge[a[p][0]]++;
p=a[p][0];
}
if(a[q][0]!=0){ //有父亲
judge[a[q][0]]++;
q=a[q][0];
}
//printf(“%d %d\n“pq);
if(j
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 33760 2019-03-01 09:26 三星研究院上机题\1- Common Ancestor in Tree.docx
文件 177348 2019-03-01 09:19 三星研究院上机题\1- sample_input.txt
文件 112 2019-03-01 09:19 三星研究院上机题\1- sample_output.txt
文件 1865 2019-03-04 10:58 三星研究院上机题\1main.cpp
文件 16495 2019-03-04 08:04 三星研究院上机题\2- Optimal Path.docx
文件 664 2019-03-04 08:02 三星研究院上机题\2- sample_input.txt
文件 81 2019-03-04 08:02 三星研究院上机题\2- sample_output.txt
文件 1781 2019-03-04 14:56 三星研究院上机题\22main.cpp
文件 1668 2019-03-04 10:40 三星研究院上机题\2main.cpp
文件 52239 2019-03-04 08:04 三星研究院上机题\3- Order of task.docx
文件 49571 2019-03-04 08:02 三星研究院上机题\3- sample_input.txt
文件 11706 2019-03-04 08:02 三星研究院上机题\3- sample_output.txt
文件 1056 2019-03-04 16:04 三星研究院上机题\3main.cpp
目录 0 2019-03-04 16:31 三星研究院上机题
----------- --------- ---------- ----- ----
348346 14
相关资源
- 通过变化的电磁耦合,大型强子对撞
- Delphi XE10.3 破解文件
- Delphi XE10.2.3破解 破解
- 剖析Linux系统下基于NUMA构建的服务
- zend studio 12 破解 注册码 key 绿色版
- CCLicenseService
- WinRAR 4.0 简体中文破解版
- 单片机仿真软件proteus6.7免安装绿色版
- UltraEdit 26.x版本 激活工具
- 一种基于LM3150 Buck型开关电源设计.p
- 百度文库、豆丁、道客巴巴文件免费
- 改善分数分频锁相环合成器中的整数
- 233网校视频器2018最新绿色版
- OdooHotelManagementSystem 基于Odoo的酒店管
- SecureCRT-6.0.2安装包和SecureCRT-6.0.2注册
- 数据结构与算法课件ppt
- 方正超粗黑简体 FZCCHJW—GB1-0 字体
- FZCCHJW-GB10
- Dr. Cleaner Pro mac破解版
- kindle epub 电子书大全
- 迅雷敏感资源限制解除小工具.zip
- Eclipse编程技术与附CD-ROM光盘
- HEU_KMS_Activator_j
- pzs_44217116_06.aia
- Git汉化资源
- digital字体
- 浪潮英信服务器NP120D用户手册
- 看门狗复位的应用技巧
- Hillstone SA-2003高性能纯硬件安全网关产
- Hillstone ARP防护——StoneOS如何保
评论
共有 条评论