浙大Pat
即时发布刷Pat(A)的AC代码
闲云阁
闲云野鹤 -> 算法仿如酒心糖,嚼着嚼着就醉了
展开
-
1106. Lowest Price in Supply Chain (25)【树+深搜】——PAT (Advanced Level) Practise
题目信息1106. Lowest Price in Supply Chain (25)时间限制200 ms 内存限制65536 kB 代码长度限制16000 B A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)– everyone involved in moving a p原创 2016-05-14 20:52:22 · 4317 阅读 · 0 评论 -
1105. Spiral Matrix (25)【模拟】——PAT (Advanced Level) Practise
题目信息1105. Spiral Matrix (25)时间限制150 ms 内存限制65536 kB 代码长度限制16000 B This time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral matrix is fil原创 2016-05-14 20:51:08 · 4099 阅读 · 0 评论 -
1104. Sum of Number Segments (20)【数学题】——PAT (Advanced Level) Practise
题目信息1104. Sum of Number Segments (20)时间限制200 ms 内存限制65536 kB 代码长度限制16000 B Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the sequence原创 2016-05-14 20:49:54 · 3811 阅读 · 0 评论 -
1103. Integer Factorization (30)【搜索+剪枝】——PAT (Advanced Level) Practise
题目信息1103. Integer Factorization (30)时间限制1200 ms 内存限制65536 kB 代码长度限制16000 B 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 su原创 2016-05-14 20:48:33 · 3768 阅读 · 0 评论 -
1102. Invert a Binary Tree (25)【二叉树】——PAT (Advanced Level) Practise
题目信息1102. Invert a Binary Tree (25)时间限制400 ms 内存限制65536 kB 代码长度限制16000 B The following is from Max Howell @twitter:Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t i原创 2016-05-14 20:46:38 · 4002 阅读 · 0 评论 -
1101. Quick Sort (25)【快排】——PAT (Advanced Level) Practise
题目信息1101. Quick Sort (25)时间限制200 ms 内存限制65536 kB 代码长度限制16000 B There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the原创 2016-05-14 20:45:28 · 3704 阅读 · 0 评论 -
1100. Mars Numbers (20)【字符串处理】——PAT (Advanced Level) Practise
题目信息1100. Mars Numbers (20)时间限制400 ms 内存限制65536 kB 代码长度限制16000 B People on Mars count their numbers with base 13:Zero on Earth is called “tret” on Mars. The numbers 1 to 12 on Earch is called “jan,原创 2016-05-14 20:43:58 · 3941 阅读 · 0 评论 -
1099. Build A Binary Search Tree (30)【二叉树】——PAT (Advanced Level) Practise
题目信息1099. Build A Binary Search Tree (30)时间限制100 ms 内存限制65536 kB 代码长度限制16000 B A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree原创 2016-05-14 20:41:37 · 4058 阅读 · 0 评论 -
1098. Insertion or Heap Sort (25)【排序】——PAT (Advanced Level) Practise
题目信息1098. Insertion or Heap Sort (25)时间限制100 ms 内存限制65536 kB 代码长度限制16000 BAccording to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list原创 2016-05-14 20:39:45 · 3651 阅读 · 0 评论 -
1097. Deduplication on a Linked List (25)【链表】——PAT (Advanced Level) Practise
题目信息1097. Deduplication on a Linked List (25)时间限制300 ms 内存限制65536 kB 代码长度限制16000 B Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated absolute value原创 2016-05-14 20:38:05 · 3576 阅读 · 0 评论 -
1096. Consecutive Factors (20)——PAT (Advanced Level) Practise
题目信息1096. Consecutive Factors (20)时间限制400 ms 内存限制65536 kB 代码长度限制16000 B Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored a原创 2016-05-14 20:36:29 · 3589 阅读 · 0 评论 -
1095. Cars on Campus (30)——PAT (Advanced Level) Practise
题目信息1095. Cars on Campus (30)时间限制220 ms 内存限制65536 kB 代码长度限制16000 B Zhejiang University has 6 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the原创 2016-05-14 20:33:08 · 3904 阅读 · 0 评论 -
1094. The Largest Generation (25)【二叉树】——PAT (Advanced Level) Practise
题目信息1094. The Largest Generation (25)时间限制200 ms 内存限制65536 kB 代码长度限制16000 B A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generat原创 2016-05-14 20:28:26 · 3486 阅读 · 0 评论 -
1093. Count PAT's (25)【计数】——PAT (Advanced Level) Practise
题目信息1093. Count PAT’s (25)时间限制120 ms 内存限制65536 kB 代码长度限制16000 B 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 secon原创 2016-05-14 20:26:01 · 3515 阅读 · 0 评论 -
1092. To Buy or Not to Buy (20)【水题】——PAT (Advanced Level) Practise
题目信息1092. To Buy or Not to Buy (20)时间限制100 ms 内存限制65536 kB 代码长度限制16000 B Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were m原创 2016-05-14 20:24:44 · 3349 阅读 · 0 评论 -
1091. Acute Stroke (30)【搜索】——PAT (Advanced Level) Practise
题目信息1091. Acute Stroke (30)时间限制400 ms 内存限制65536 kB 代码长度限制16000 B One important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the results of image analysis in which原创 2016-05-14 20:23:20 · 3296 阅读 · 0 评论 -
1090. Highest Price in Supply Chain (25)【树】——PAT (Advanced Level) Practise
题目信息1090. Highest Price in Supply Chain (25)时间限制200 ms 内存限制65536 kB 代码长度限制16000 B A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)– everyone involved in moving a原创 2016-05-14 20:20:12 · 3360 阅读 · 0 评论 -
1089. Insert or Merge (25)【排序】——PAT (Advanced Level) Practise
题目信息1089. Insert or Merge (25)时间限制200 ms 内存限制65536 kB 代码长度限制16000 BInsertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion so原创 2016-05-14 20:18:04 · 3595 阅读 · 0 评论 -
1088. Rational Arithmetic (20)——PAT (Advanced Level) Practise
题目信息1088. Rational Arithmetic (20)时间限制200 ms 内存限制65536 kB 代码长度限制16000 B For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, produc原创 2016-05-14 20:15:08 · 3198 阅读 · 0 评论 -
1087. All Roads Lead to Rome (30)【最短路】——PAT (Advanced Level) Practise
题目信息1087. All Roads Lead to Rome (30)时间限制200 ms 内存限制65536 kB 代码长度限制16000 B Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with原创 2016-05-14 20:08:27 · 4172 阅读 · 0 评论 -
1086. Tree Traversals Again (25)【二叉树】——PAT (Advanced Level) Practise
题目信息1086. Tree Traversals Again (25)时间限制200 ms 内存限制65536 kB 代码长度限制16000 B An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-原创 2016-03-19 01:12:26 · 2181 阅读 · 0 评论 -
1085. Perfect Sequence (25)【二分查找】——PAT (Advanced Level) Practise
题目信息1085. Perfect Sequence (25)时间限制300 ms 内存限制65536 kB 代码长度限制16000 B Given a sequence of positive integers and another positive integer p. The sequence is said to be a “perfect sequence” if M <= m *原创 2016-03-19 01:10:17 · 1067 阅读 · 0 评论 -
1084. Broken Keyboard (20)【字符串操作】——PAT (Advanced Level) Practise
题目信息1084. Broken Keyboard (20)时间限制200 ms 内存限制65536 kB 代码长度限制16000 B On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys w原创 2016-03-19 00:41:20 · 1084 阅读 · 0 评论 -
1083. List Grades (25)【水题】——PAT (Advanced Level) Practise
题目信息1083. List Grades (25)时间限制400 ms 内存限制65536 kB 代码长度限制16000 B Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-incre原创 2016-03-19 00:40:00 · 1088 阅读 · 0 评论 -
1082. Read Number in Chinese (25)【字符串处理】——PAT (Advanced Level) Practise
题目信息1082. Read Number in Chinese (25)时间限制400 ms 内存限制65536 kB 代码长度限制16000 B Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output “Fu” first原创 2016-03-19 00:38:25 · 1547 阅读 · 0 评论 -
1081. Rational Sum (20)【模拟】——PAT (Advanced Level) Practise
题目信息1081. Rational Sum (20)时间限制400 ms 内存限制65536 kB 代码长度限制16000 B Given N rational numbers in the form “numerator/denominator”, you are supposed to calculate their sum.Input Specification:Each input原创 2016-03-19 00:36:46 · 1299 阅读 · 0 评论 -
1080. Graduate Admission (30)【排序】——PAT (Advanced Level) Practise
题目信息1080. Graduate Admission (30)时间限制200 ms 内存限制65536 kB 代码长度限制16000 B It is said that in 2013, there were about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province.原创 2016-03-19 00:13:35 · 1094 阅读 · 0 评论 -
1079. Total Sales of Supply Chain (25)【树+搜索】——PAT (Advanced Level) Practise
题目信息1079. Total Sales of Supply Chain (25)时间限制250 ms 内存限制65536 kB 代码长度限制16000 B A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)– everyone involved in moving a pr原创 2016-03-19 00:10:57 · 1113 阅读 · 0 评论 -
1078. Hashing (25)【Hash + 探测】——PAT (Advanced Level) Practise
题目信息1078. Hashing (25)时间限制100 ms 内存限制65536 kB 代码长度限制16000 B The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the inp原创 2016-03-19 00:07:13 · 1133 阅读 · 0 评论 -
1077. Kuchiguse (20)【字符串处理】——PAT (Advanced Level) Practise
题目信息1077. Kuchiguse (20)时间限制100 ms 内存限制65536 kB 代码长度限制16000 BThe Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflect原创 2016-01-09 23:15:21 · 1386 阅读 · 0 评论 -
1076. Forwards on Weibo (30)【树+搜索】——PAT (Advanced Level) Practise
题目信息1076. Forwards on Weibo (30)时间限制3000 ms 内存限制65536 kB 代码长度限制16000 BWeibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as w原创 2016-01-09 23:12:23 · 1102 阅读 · 0 评论 -
1075. PAT Judge (25)【排序】——PAT (Advanced Level) Practise
题目信息1075. PAT Judge (25)时间限制200 ms 内存限制65536 kB 代码长度限制16000 BThe ranklist of PAT is generated from the status list, which shows the scores of the submittions. This time you are supposed to generate t原创 2016-01-09 23:07:15 · 1117 阅读 · 0 评论 -
1074. Reversing Linked List (25)【链表翻转】——PAT (Advanced Level) Practise
题目信息1074. Reversing Linked List (25)时间限制400 ms 内存限制65536 kB 代码长度限制16000 BGiven a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, gi原创 2016-01-02 20:39:51 · 1496 阅读 · 0 评论 -
1073. Scientific Notation (20)【字符串操作】——PAT (Advanced Level) Practise
题目信息1073. Scientific Notation (20)时间限制100 ms 内存限制65536 kB 代码长度限制16000 BScientific notation is the way that scientists easily handle very large numbers or very small numbers. The notation matches the原创 2016-01-02 20:04:59 · 1294 阅读 · 0 评论 -
1072. Gas Station (30)【最短路dijkstra】——PAT (Advanced Level) Practise
题目信息1072. Gas Station (30)时间限制200 ms 内存限制65536 kB 代码长度限制16000 BA 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原创 2016-01-02 19:59:35 · 1631 阅读 · 0 评论 -
1071. Speech Patterns (25)【字符串操作】——PAT (Advanced Level) Practise
题目信息1071. Speech Patterns (25)时间限制300 ms 内存限制65536 kB 代码长度限制16000 BPeople often have a preference among synonyms of the same word. For example, some may prefer “the police”, while others may prefer “原创 2015-12-27 23:05:52 · 1402 阅读 · 1 评论 -
1070. Mooncake (25)【贪心】——PAT (Advanced Level) Practise
题目信息1070. Mooncake (25)时间限制100 ms 内存限制65536 kB 代码长度限制16000 BMooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts can be found in原创 2015-12-27 23:03:26 · 1303 阅读 · 0 评论 -
1069. The Black Hole of Numbers (20)【模拟】——PAT (Advanced Level) Practise
题目信息1069. The Black Hole of Numbers (20)时间限制100 ms 内存限制65536 kB 代码长度限制16000 BFor any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order原创 2015-12-27 23:01:17 · 1197 阅读 · 0 评论 -
1068. Find More Coins (30)【背包】——PAT (Advanced Level) Practise
题目信息1068. Find More Coins (30)时间限制150 ms 内存限制65536 kB 代码长度限制16000 BEva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopp原创 2015-12-27 22:56:45 · 1457 阅读 · 0 评论 -
1067. Sort with Swap(0,*) (25)【贪心】——PAT (Advanced Level) Practise
题目信息1067. Sort with Swap(0,*) (25)时间限制150 ms 内存限制65536 kB 代码长度限制16000 BGiven any permutation of the numbers {0, 1, 2,…, N-1}, it is easy to sort them in increasing order. But what if Swap(0, *) is th原创 2015-12-27 00:53:17 · 1446 阅读 · 1 评论