自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 【PAT甲级】1115 Counting Nodes in a BST (30分):构造BST+DFS树的遍历

1115 Counting Nodes in a BST (30分) A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of a node contains only nodes with keys...

2020-02-17 15:44:00 99

原创 PAT备错本

更新:1115 - [1115 Counting Nodes in a BST:LIU] build函数内,为root声明变量地址root =new node();,不需要node* root =new node();,这样是重新声明另一个变量。 node* build(node* &root,int v) { if(root==NULL) { roo...

2020-02-17 15:41:00 86

原创 【PAT甲级】1004 Counting Leaves (30分):DFS/BFS树的遍历

1004 Counting Leaves (30分) A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. Input Specification: Each input file contains o...

2020-02-16 15:32:00 141

原创 【PAT甲级】1053 Path of Equal Weight (30分):DFS(树的先序遍历)

题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805424153280512 1053 Path of Equal Weight (30分) Given a non-empty tree with root R, and with weight *W**i* assigned to each tree n...

2020-02-10 22:40:00 120

原创 PAT错误总结

本地能运行,但PAT显示编译错误 缺少头文件 变量取名不要使用C++库函数同名等此类关键词,例如:给数组取名time[]。会判定缺少头文件。 输出格式有误 ...

2020-02-10 22:39:00 380

原创 PAT小知识总结

vector 比较两个vector是否相等、大小,可以用“==”、“>=”、“<=”等 参考:https://blog.csdn.net/liuchuo/article/details/52486206?utm_source=blogxgwz0

2020-02-10 14:53:00 201

原创 【PAT甲级】1048 Find Coins (25分):哈希

1048 Find Coins (25分) Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of ...

2020-02-10 13:27:00 93

原创 【PAT甲级】1020 Tree Traversals (25分):树的创建、遍历

1020 Tree Traversals (25分) Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level ord...

2020-02-10 13:17:00 79

原创 【PAT甲级】1092 To Buy or Not to Buy (20分):哈希

题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805374509498368 1092 To Buy or Not to Buy (20分) Eva would like to make a string of beads with her favorite colors so she went to a...

2020-02-09 14:06:00 90

原创 【PAT甲级】1034 Head of a Gang (30分):图的遍历DFS

1034 Head of a Gang (30分) One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call between A and B, we say that A and B is related. The weight o...

2020-02-07 20:35:00 144

原创 【PAT甲级】1030 Travel Plan (30分):最短路径Dijkstra/Dijkstra+DFS

1030 Travel Plan (30分) A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler t...

2020-02-07 14:37:00 467

原创 【PAT甲级】1003 Emergency (25分)

1003 Emergency (25分):最短路径Dijkstra算法 As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amou...

2020-02-02 14:36:00 292

空空如也

空空如也

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

TA关注的人

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