
PAT(甲级)
love亦菲
业精于勤,荒于嬉;行成于思,毁于随。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
pat 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 from one root supplier, everyone on th原创 2016-07-23 22:03:56 · 647 阅读 · 0 评论 -
pat 1024. Palindromic Number (25)
A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers原创 2015-11-29 15:43:36 · 370 阅读 · 0 评论 -
pat 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. TheMaximum Subsequence is the continuous subsequence which原创 2015-11-28 23:33:25 · 343 阅读 · 0 评论 -
pat 1078. Hashing (25)
The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. The hash function is defined to be "H(key) = key %原创 2016-07-26 09:58:31 · 387 阅读 · 0 评论 -
pat 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 less than or equal to the node's key.原创 2016-07-22 09:18:55 · 1181 阅读 · 0 评论 -
pat 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 less than the node's key.The right subt原创 2016-07-21 10:47:57 · 733 阅读 · 0 评论 -
pat 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 less than the node's key.The right原创 2016-07-22 10:16:03 · 456 阅读 · 0 评论 -
pat 1068. Find More Coins (30)
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 coins as payments. However,原创 2016-08-22 10:19:09 · 629 阅读 · 0 评论 -
pat 1103. Integer Factorization (30)
The K-P factorization of a positive integer N is to write N as the sum of the P-th power of K positive integers. You are supposed to write a program to find the K-P factorization of N for any positive原创 2016-08-14 21:54:03 · 598 阅读 · 0 评论 -
pat 1093. Count PAT's (25)
The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by the 3rd, the 4th, and the 6th characters.No原创 2015-11-29 16:30:01 · 443 阅读 · 0 评论 -
pat 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 decide the shortest path b原创 2015-11-29 20:51:41 · 682 阅读 · 0 评论 -
pat 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 highest tree. Such a root原创 2016-07-25 09:10:07 · 407 阅读 · 0 评论 -
pat 1107. Social Clusters (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 set of people who have some of th原创 2015-12-20 16:40:39 · 801 阅读 · 0 评论 -
pat 1110. Complete Binary Tree (25)
Given a tree, you are supposed to tell if it is a complete binary tree.Input Specification:Each input file contains one test case. For each case, the first line gives a positive integer N (<=20) w原创 2016-07-20 18:01:48 · 735 阅读 · 0 评论 -
pat 1102. 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 whiteboard so fuck off.Now it's your turn to p原创 2016-07-20 11:31:10 · 442 阅读 · 0 评论 -
pat 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.InputEach input file contains one test case. Each case starts with a line原创 2016-07-19 16:17:26 · 654 阅读 · 0 评论 -
pat 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 less than the node's key.The right原创 2016-07-19 13:44:57 · 376 阅读 · 0 评论 -
pat 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 traversal sequence of the cor原创 2016-07-19 10:26:07 · 437 阅读 · 0 评论 -
pat 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 happiness.Input Specification:Each原创 2015-12-21 16:03:09 · 782 阅读 · 0 评论 -
pat1135 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.(2) The root is black.(3) Every原创 2017-09-26 17:59:18 · 1250 阅读 · 0 评论