自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 收藏
  • 关注

原创 PAT 1118 Birds in Forest

1118 Birds in Forest(25 分) Some scientists took pictures of thousands of birds in a forest. Assume that all the birds appear in the same picture belong to the same tree. You are supposed to help the ...

2018-08-02 10:07:28 121

原创 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 nee...

2018-08-01 23:48:13 126

原创 PAT 1107 Social Clusters

1107 Social Clusters (30)(30 分) When register on a social network, you are always asked to specify your hobbies in order to find some potential friends with the same hobbies. A “social cluster” is a ...

2018-08-01 23:40:02 146

原创 并查集简析

关键是掌握两个关键操作一个是找到一个集合父节点Find函数, 另一个操作是合并两个集合的操作Union函数。#define MAXN 1000 /* 集合最大元素个数 */typedef int ElementType; /* 默认元素可以用非负整数表示 */typedef int SetName; /* 默...

2018-08-01 23:33:37 110

原创 最短路径简析

如果是无权图的最短路径可以使用DFS来求最短路径,比较方便,可以记录路径和距离,维护一些变量也较为方便。// s,end1分别是起点和终点tempath.push_back(s);void dfs(int node, int cnt){ if(node==end1&&(cnt<mincnt)){ //判断是否到达了终点和是否更新路径 a...

2018-08-01 23:26:36 216

原创 PAT 1131 Subway Map

1131 Subway Map(30 分) In the big cities, the subway systems always look so complex to the visitors. To give you some sense, the following figure shows the map of Beijing subway. Now you are supposed ...

2018-08-01 23:23:18 314

原创 PAT 1111 Online Map

1111 Online Map(30 分) Input our current position and a destination, an online map can recommend several paths. Now your job is to recommend two paths to your user: one is the shortest, and the other ...

2018-08-01 23:19:51 130

原创 红黑树(RED BLACK TREE/RB Tree)

红黑树是每个节点都带有颜色属性的二叉查找树,颜色或红色或黑色。在二叉查找树强制一般要求以外,对于任何有效的红黑树我们增加了如下的额外要求:性质1. 节点是红色或黑色。性质2. 根节点是黑色。性质3 每个叶节点(NIL节点,空节点)是黑色的。性质4 每个红色节点的两个子节点都是黑色。(从每个叶子到根的所有路径上不能+ 有两个连续的红色节点)性质5. 从任一节点到其每个叶子的所有路径都包...

2018-08-01 22:55:13 141

原创 PAT 1135 Is It A Red-Black Tree

1135 Is It A Red-Black Tree(30 分) There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 properties:(1) Every node is either red or black....

2018-08-01 22:53:49 196

原创 PAT 1085 PAT单位排行

每次 PAT 考试结束后,考试中心都会发布一个考生单位排行榜。本题就请你实现这个功能。输入格式: 输入第一行给出一个正整数 N(≤10^5),即考生人数。随后 N 行,每行按下列格式给出一个考生的信息:准考证号 得分 学校其中准考证号是由 6 个字符组成的字符串,其首字母表示考试的级别:B代表乙级,A代表甲级,T代表顶级;得分是 [0, 100] 区间内的整数;学校是由不超过 6 个...

2018-08-01 10:47:39 459

原创 PAT 1104 Sum of Number Segments

Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the sequence {0.1, 0.2, 0.3, 0.4}, we have 10 segments: (0.1) (0.1, 0.2) (0.1, 0.2, 0.3) ...

2018-08-01 10:33:30 171

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除