PAT
PAT甲级题目的一些解答,使用Java语言 目前我的解答数量为100道
Fellow@
持续学习者
展开
-
PAT 1002 多项式相加
1002 A+B for Polynomials (25分)This time, you are supposed to find A+B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and e...原创 2020-04-25 23:33:46 · 175 阅读 · 0 评论 -
PAT 1001简单模拟
1001 A+B Format (20分)Calculate a+b and output the sum in standard format – that is, the digits must be separated into groups of three by commas (unless there are less than four digits).Input Specifi...原创 2020-04-25 22:40:49 · 127 阅读 · 0 评论 -
PAT1003 带权图的最短路径
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 i...原创 2020-04-20 16:38:46 · 314 阅读 · 0 评论 -
PAT1076图的遍历(微博转发人数)
1076 Forwards on Weibo (30分)Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with...原创 2020-04-20 15:23:54 · 162 阅读 · 1 评论 -
PAT1034带权图遍历
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 of a r...原创 2020-04-18 22:12:58 · 573 阅读 · 0 评论 -
PAT1021 最大高度的树的根节点
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 hi...原创 2020-04-18 17:59:37 · 134 阅读 · 0 评论 -
PAT1013删除顶点后的连通分量的个数
1013 Battle Over Cities (25分)It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We m...原创 2020-04-18 15:59:51 · 333 阅读 · 0 评论 -
PAT1066 平衡二叉树的根节点
1066 Root of AVL Tree (25分)An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they differ by m...原创 2020-04-18 00:19:17 · 669 阅读 · 0 评论 -
PAT1099构建BST输出层序遍历
1099 Build A Binary Search Tree (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 l...原创 2020-04-17 17:42:56 · 160 阅读 · 0 评论 -
PAT1064 完全二叉搜索树
1064 Complete Binary Search Tree (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-04-17 16:39:53 · 183 阅读 · 0 评论 -
PAT1043给定序列是否是BST或其镜像的前序
1043 Is It a Binary Search Tree (25分)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 l...原创 2020-04-17 15:57:17 · 97 阅读 · 0 评论 -
PAT1053多叉树带权路径搜索回溯算法
1053 Path of Equal Weight (30分)Given a non-empty tree with root R, and with weight W**i assigned to each tree node T**i. The **weight of a path from **R to L is defined to be the sum of the weights ...原创 2020-04-16 23:05:35 · 512 阅读 · 0 评论 -
PAT1004多叉树 叶子节点的个数
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 one te...原创 2020-04-16 21:42:33 · 858 阅读 · 0 评论 -
PAT1106多叉树
1106 Lowest Price in Supply Chain (25分)A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting...原创 2020-04-16 21:00:30 · 221 阅读 · 2 评论 -
PAT1094 多叉树
1094 The Largest Generation (25分)A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation wi...原创 2020-04-16 17:26:57 · 116 阅读 · 0 评论 -
PAT1090多叉树
1090 Highest Price in Supply Chain (25分)A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Startin...原创 2020-04-16 16:24:44 · 93 阅读 · 0 评论 -
PAT1079多叉树
1079 Total Sales of Supply Chain (25分)A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting ...原创 2020-04-15 22:52:47 · 132 阅读 · 0 评论 -
PAT1102翻转二叉树
数据结构 翻转二叉树 11021102 Invert a Binary Tree (25分)The following is from Max Howell @twitter:Google: 90% of our engineers use the software you wrote (Homebrew), but you can't invert a binary tree on a w...原创 2020-04-15 21:19:19 · 81 阅读 · 0 评论 -
PAT1086二叉树的创建+遍历
1086 Tree Traversals Again (25分)An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered fr...原创 2020-04-15 16:07:10 · 113 阅读 · 0 评论 -
PAT1020二叉树遍历
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 tr...原创 2020-04-14 23:30:51 · 142 阅读 · 0 评论