
PAT甲级
文章平均质量分 76
POFEI_IS_SHIT
不是我针对谁,在座的各位都是垃圾
展开
-
1122. Hamiltonian Cycle (25)
The "Hamilton cycle problem" is to find a simple cycle that contains every vertex in a graph. Such a cycle is called a "Hamiltonian cycle". In this problem, you are supposed to tell if a given cycle原创 2016-12-14 12:26:34 · 441 阅读 · 0 评论 -
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 from one root supplier, everyone on the ch原创 2017-01-04 12:32:27 · 252 阅读 · 0 评论 -
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.Starting from one root supplier, everyone on the ch原创 2017-01-04 12:43:27 · 220 阅读 · 0 评论 -
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 the ch原创 2017-01-04 12:50:37 · 204 阅读 · 0 评论 -
1123. Is It a Complete AVL Tree (30)
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 more than one, rebalancing is原创 2016-12-28 14:05:54 · 298 阅读 · 0 评论 -
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 in each city and the le原创 2017-01-05 16:33:23 · 232 阅读 · 0 评论 -
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 subtr原创 2016-12-29 14:51:35 · 258 阅读 · 0 评论 -
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 (<=2原创 2016-12-20 13:28:48 · 232 阅读 · 0 评论 -
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 must know immediately if we need原创 2017-01-10 20:56:38 · 196 阅读 · 0 评论 -
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原创 2016-12-19 13:25:36 · 275 阅读 · 0 评论 -
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原创 2016-12-19 12:42:38 · 203 阅读 · 0 评论 -
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 from 1 to 6) is traversed, the stac原创 2016-12-18 12:08:04 · 194 阅读 · 0 评论 -
1121. Damn Single (25)
"Damn Single (单身狗)" is the Chinese nickname for someone who is being single. You are supposed to find those who are alone in a big party, so they can be taken care of. Input Specification: Each inpu原创 2016-12-14 12:37:21 · 553 阅读 · 0 评论 -
1120. Friend Numbers (20)
Two integers are called "friend numbers" if they share the same sum of their digits, and the sum is their "friend ID". For example, 123 and 51 are friend numbers since 1+2+3 = 5+1 = 6, and 6 is their原创 2016-12-14 12:38:16 · 252 阅读 · 0 评论 -
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 corr原创 2016-12-16 14:38:17 · 1178 阅读 · 0 评论 -
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 righ原创 2016-12-16 15:24:22 · 275 阅读 · 0 评论 -
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 more than one, rebalancing is原创 2016-12-16 16:48:25 · 346 阅读 · 0 评论 -
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. The原创 2016-12-21 11:33:25 · 250 阅读 · 0 评论 -
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 with the largest population.Input Spe原创 2017-01-02 14:27:29 · 227 阅读 · 0 评论 -
1053. Path of Equal Weight (30)
Given a non-empty tree with root R, and with weight Wi assigned to each tree node Ti. The weight of a path from R to L is defined to be the sum of the weights of all the nodes along the path from R to原创 2017-01-03 14:26:47 · 202 阅读 · 0 评论 -
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 conta原创 2017-01-01 15:27:55 · 178 阅读 · 0 评论