![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PAT
文章平均质量分 86
lln_123
这个作者很懒,什么都没留下…
展开
-
PAT乙级1068 万绿丛中一点红(20 分)
这道题注意题目中的“独一无二”,就是必须这个点只能出现一次。与其8个周围的点并不是指只能在内圈进行扫描,在最外圈也必须扫描,8个周围的点意思表达不明确。最后没法通过一个超时的例子,需要把cin换成scanf,因为cin效率比scanf效率低很多。这就是这道题的几个坑点。下面代码:#include<iostream>#include<vector>#include<...原创 2018-07-05 15:29:20 · 1005 阅读 · 0 评论 -
PAT甲级1072 Gas Station (30)
1072 Gas Station (30 分)A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as possible. However it must g...原创 2018-11-17 23:27:25 · 162 阅读 · 0 评论 -
PAT甲级 根据前中后序遍历建树总结
目前pat甲级涉及到的题目如下: 1020 Tree Traversals (25) 根据后序和中序建树,输出层序 1119 Pre- and Post-order Traversals (30) 根据前序和后序模拟树,输出中序 1127 ZigZagging on a Tree (30) ...原创 2018-11-20 20:02:04 · 225 阅读 · 0 评论 -
PAT甲级1127 ZigZagging on a Tree (30)
1127 ZigZagging on a Tree (30 分)Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder traversal s...原创 2018-11-24 20:04:09 · 158 阅读 · 0 评论 -
PAT甲级1138 Postorder Traversal (25)
1138 Postorder Traversal (25 分)Suppose that all the keys in a binary tree are distinct positive integers. Given the preorder and inorder traversal sequences, you are supposed to output the first num...原创 2018-11-26 21:30:07 · 146 阅读 · 0 评论 -
PAT甲级1010 Radix (25)
1010 Radix (25 分)Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is yes, if 6 is a decimal number and 110 is a binary number.Now for any pa...原创 2018-12-01 21:51:13 · 130 阅读 · 0 评论 -
PAT甲级 1012 The Best Rank (25)
1012 The Best Rank (25 分)To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or L...原创 2019-01-01 23:35:55 · 131 阅读 · 0 评论 -
PAT甲级 1115 Counting Nodes in a BST (30)
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 le...原创 2019-02-03 17:48:40 · 144 阅读 · 0 评论 -
PAT甲级 1126 Eulerian Path (25)
1126 Eulerian Path (25 分)In graph theory, an Eulerian path is a path in a graph which visits every edge exactly once. Similarly, an Eulerian circuit is an Eulerian path which starts and ends on the ...原创 2019-02-18 14:56:20 · 172 阅读 · 0 评论 -
PAT甲级1119 Pre- and Post-order Traversals (30)
1119 Pre- and Post-order Traversals (30 分)Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder t...原创 2018-11-22 21:03:26 · 413 阅读 · 1 评论 -
PAT甲级1087 All Roads Lead to Rome (30)
1087 All Roads Lead to Rome (30 分)Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the most hap...原创 2018-11-20 00:01:44 · 201 阅读 · 0 评论 -
PAT甲级1030 Travel Plan (30)
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 to d...原创 2018-11-16 23:00:09 · 125 阅读 · 0 评论 -
PAT甲级1038 Recover the Smallest Number (30)
这道题大意是给你一组数字,让你改变顺序自由组合最后要得到值最小的那个序列。先前按照自己的思路来做才得了20分应该还有某种情况没有考虑到,答案却十分简洁,我们必须要用string对象接受数字,利用字符串拼接后比较大小进行自定义排序:#include<iostream>#include<string>#include<algorithm>using ...原创 2018-08-22 19:27:30 · 280 阅读 · 0 评论 -
PAT甲级Dijkstra总结
目前PAT甲级中涉及Dijkstra的题目有如下几题: 1003 Emergency (25) 1018 Public Bike Management (30) ...原创 2018-11-15 20:59:26 · 502 阅读 · 0 评论 -
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 order ...原创 2018-11-19 00:00:26 · 148 阅读 · 0 评论 -
PAT甲级1003 Emergency (25)
1003 Emergency (25 分)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. Amount of rescue teams...原创 2018-11-14 20:28:23 · 117 阅读 · 0 评论 -
PAT甲级1018 Public Bike Management (30)
1018 Public Bike Management (30 分)There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any station and ret...原创 2018-11-14 20:38:37 · 267 阅读 · 0 评论 -
PAT甲级1111 Online Map (30)
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-11-20 21:00:02 · 144 阅读 · 0 评论 -
PAT甲级1007 Maximum Subsequence Sum (25)
1007 Maximum Subsequence Sum (25 分)Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1≤i≤j≤K. The Maximum Su...原创 2018-11-16 20:55:31 · 113 阅读 · 0 评论 -
PAT甲级 最大连续子序列和
目前PAT甲级中涉及Dijkstra的题目有如下几题: 1007 Maximum Subsequence Sum (25) 最大连续子序列和提供两种写法:1.动态规划(1)不记录起点和终点下标:int a[maxn],dp[maxn];//a[i]存放序列,dp[i]存放以a[i]结尾的连续序列的最大和dp[0]=a[0]...原创 2018-11-16 21:02:54 · 651 阅读 · 0 评论 -
PAT甲级 1131 Subway Map (30)
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...原创 2019-02-19 11:50:05 · 218 阅读 · 0 评论