![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PAT
philpanic9
这个作者很懒,什么都没留下…
展开
-
PAT 1003 Emergency
PAT 1003 Emergency 原题链接参考博客 链接题目描述及示例输入输出见上面链接题目分析:本题给出一个图,图中每个节点有一定数量的救援队,给出起点和终点,希望你输出由起点到终点的最短路径的条数以及沿着最短路径能召唤到的最多的救援队数量。由于最短路径想到用单源最短路径算法Dijkstra算法,但是在本题中需要做一些改变,需要记录最短路径的条数和能召唤到救援队的数量的最大值。先...原创 2018-10-04 22:57:03 · 132 阅读 · 0 评论 -
PAT 1060 Are They Equal字符串模拟
If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123×1050.123×10^50.123×105 with simple chopping. Now giv...原创 2019-08-26 10:48:10 · 87 阅读 · 0 评论 -
PAT 1051 Pop Sequence stack+set
Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, …, N and pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequence of the...原创 2019-08-16 19:26:06 · 144 阅读 · 0 评论 -
PAT 1059 Prime Factors 埃式筛法
Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N=p1k1×p2k2×⋯×pmkmN = {p_1}^{k_1}×{p_2}^{k_2}×⋯×{p_m}^{k_m}N=p1k1×p2k2×⋯×pmkm...原创 2019-08-25 22:58:19 · 102 阅读 · 0 评论 -
PAT 1044 Shopping in Mars 二分查找
Shopping in Mars is quite a different experience. The Mars people pay by chained diamonds. Each diamond has a value (in Mars dollars M$). When making the payment, the chain can be cut at any position ...原创 2019-08-15 22:15:56 · 126 阅读 · 0 评论 -
PAT 1074 Reversing Linked List 双端队列
Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, if K=3, then you must output 3→2→1→6→5→4; if K=4,...原创 2019-08-15 00:52:47 · 99 阅读 · 0 评论 -
PAT 1017 Queueing at Bank 模拟
Suppose a bank has K windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. All the customers have to wait in line behind the yellow li...原创 2019-08-07 16:54:29 · 78 阅读 · 0 评论 -
PAT 1033 To Fill or Not to Fill 模拟+贪心
With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time to time. Different ga...原创 2019-08-13 21:41:10 · 131 阅读 · 0 评论 -
PAT 1097 Deduplication on a Linked List STL使用
Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated absolute values of the keys. That is, for each value K, only the first node of which the value or a...原创 2019-08-08 22:23:12 · 101 阅读 · 0 评论 -
PAT 1099 Build A Binary Search Tree 递归构造二叉树
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 less than the node’s key.The right subt...原创 2019-08-08 19:19:46 · 158 阅读 · 0 评论 -
PAT 1034 Head of a Gang DFS
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 of a relation is defined to be t...原创 2019-08-02 23:53:51 · 74 阅读 · 0 评论 -
PAT 1053 Path of Equal Weight dfs
这道题和 1018 Public Bike Management(题解)解题思路上是一样的。    使用dfs从根结点开始遍历,使用temppath记录路径,如果之前经过的权值总和加上当前访问的结点的权值之和恰好等于目标权值并且当前结点为叶节点,则将temppath记录下来( paths.push_back(temppath) ),最后对paths进行排序...原创 2019-03-12 20:58:12 · 86 阅读 · 0 评论 -
PAT 1018 Public Bike Management
参考链接:柳婼 の blog—1018. Public Bike Management (30)-PAT甲级真题(Dijkstra + DFS)    题目就不贴了。    个人感觉这道题挺有质量的,做一下学习记录。...原创 2019-03-12 20:43:43 · 167 阅读 · 0 评论 -
PAT 1045 Favorite Color Stripe dfs+记忆化搜索
1045 Favorite Color Stripe (30 分)Eva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off those unwanted pie...原创 2019-03-12 20:14:22 · 144 阅读 · 0 评论 -
PAT 1016 Phone Bills
1016 Phone Bills (25 分)A long-distance telephone company charges its customers by the following rules:Making a long-distance call costs a certain amount per minute, depending on the time of day when...原创 2019-03-06 09:24:22 · 89 阅读 · 0 评论 -
PAT 1021 Deepest Root DFS
1021 Deepest Root (25 分)A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a h...原创 2019-03-05 21:22:09 · 115 阅读 · 0 评论 -
PAT 1064 Complete Binary Search Tree 完全二叉搜索树填值
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 less than the node’s key.The right sub...原创 2019-08-26 16:22:41 · 109 阅读 · 0 评论