- 博客(239)
- 收藏
- 关注
原创 PAT 甲级 1105. Spiral Matrix (25)
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 filled in from the first element at the upper-left corner, then move in
2017-10-09 20:22:55 274
原创 PAT 甲级 1104. Sum of Number Segments (20)
Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the sequence {0.1, 0.2, 0.3, 0.4}, we have 10 segments: (0.1) (0.1, 0.2) (0.1, 0.2, 0.3)
2017-10-09 15:22:58 163
原创 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
2017-10-09 15:16:21 177
原创 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
2017-10-09 15:00:02 177
原创 PAT 甲级 1101. Quick Sort (25)
There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then the elements less than the pivot are moved to its le
2017-10-08 15:23:12 170
原创 PAT 甲级 1100. Mars Numbers (20)
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, feb, mar, apr, may, jun, jly, aug, sep, oct, nov, dec" on Ma
2017-10-06 23:20:38 163
原创 PAT 甲级 1099. Build A Binary Search Tree (30)
c 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 r
2017-10-06 23:19:52 170
原创 PAT 甲级 1098. Insertion or Heap Sort (25)
According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. At each iteration, insertion sort removes one element from the input
2017-10-06 22:30:15 196
原创 PAT 甲级 1097. Deduplication on a Linked List (25)
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
2017-10-06 21:57:09 283
原创 PAT 甲级 1096. Consecutive Factors (20)
Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3*5*6*7, where 5, 6, and 7 are the three consecutive numbers. Now given
2017-10-06 20:30:15 170
原创 PAT 甲级 1095. Cars on Campus (30)
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 cars crossing the gate. Now with all the information available, you a
2017-10-06 17:51:53 172
原创 PAT 甲级 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. Inpu
2017-10-06 16:55:31 176
原创 PAT 甲级 1093. Count PAT's (25)
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 many colorful strings of beads. However the owner of the shop would only sel
2017-10-06 15:44:05 171
原创 PAT 甲级 1091. Acute Stroke (30)
One important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the results of image analysis in which the core regions are identified in each MRI slice, your job is to c
2017-10-06 15:43:15 224
原创 PAT 甲级 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
2017-10-06 15:19:51 200
原创 PAT 甲级 1089. Insert or Merge (25)
According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input dat
2017-10-06 00:12:26 187
原创 PAT 甲级 1088. Rational Arithmetic (20)
For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and quotient. Input Specification: Each input file contains one te
2017-10-05 20:19:48 286
原创 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: E
2017-10-05 20:14:08 356
原创 PAT 甲级 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
2017-10-05 18:51:43 169
原创 PAT 甲级 1085. Perfect Sequence (25)
Given a sequence of positive integers and another positive integer p. The sequence is said to be a "perfect sequence" if M Now given a sequence and a parameter p, you are supposed to find from the
2017-10-05 18:07:03 234
原创 PAT 甲级 1084. Broken Keyboard (20)
On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen. Now given a string that you are supposed
2017-10-05 17:52:57 159
原创 PAT 甲级 1083. List Grades (25)
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-increasing order, and output those student records of which the grades
2017-10-05 17:43:29 173
原创 PAT 甲级 1082. Read Number in Chinese (25)
Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output "Fu" first if it is negative. For example, -123456789 is read as "Fu yi Yi er Qian san B
2017-10-05 17:21:07 212
原创 PAT 甲级 1081. Rational Sum (20)
Given N rational numbers in the form "numerator/denominator", you are supposed to calculate their sum. Input Specification: Each input file contains one test case. Each case starts with a positi
2017-10-05 16:42:06 194
原创 PAT 甲级 1080. Graduate Admission (30)
It is said that in 2013, there were about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if you could write a program to automate the admissio
2017-10-05 00:13:52 191
原创 PAT 甲级 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
2017-10-04 20:23:31 197
原创 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 %
2017-10-04 19:12:32 214
原创 PAT 甲级 1077. Kuchiguse (20)
The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker's personality. Such a preference is called
2017-10-04 16:39:24 160
原创 PAT 甲级 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 followers relations. When a
2017-10-04 16:24:16 164
原创 PAT 甲级 1075. PAT Judge (25)
The ranklist of PAT is generated from the status list, which shows the scores of the submittions. This time you are supposed to generate the ranklist for PAT. Input Specification: Each input fil
2017-10-03 12:48:30 175
原创 PAT 甲级 1074. Reversing Linked List (25)
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
2017-10-03 10:36:06 405
原创 PAT 甲级 1073. Scientific Notation (20)
Scientific notation is the way that scientists easily handle very large numbers or very small numbers. The notation matches the regular expression [+-][1-9]"."[0-9]+E[+-][0-9]+ which means that the in
2017-10-02 19:57:14 175
原创 PAT 甲级 1072. Gas Station (30)
A 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 far away as possible. However it must guarantee that all the hou
2017-10-02 18:48:08 194
原创 PAT 甲级 1071. Speech Patterns (25)
People often have a preference among synonyms of the same word. For example, some may prefer "the police", while others may prefer "the cops". Analyzing such patterns can help to narrow down a speaker
2017-10-02 16:56:04 210
原创 PAT 甲级 1070. Mooncake (25)
Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts can be found in traditional mooncakes according to the region's culture. Now
2017-10-02 16:45:22 213
原创 PAT 甲级 1069. The Black Hole of Numbers (20)
For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order first, and then in non-decreasing order, a new number can be obtained by takin
2017-10-02 16:21:20 202
原创 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,
2017-10-02 12:00:13 165
原创 PAT 甲级 1067. Sort with Swap(0,*) (25)
Given 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 the ONLY operation that is allowed to use? For example, to sort {4, 0, 2
2017-10-02 09:58:38 161
原创 PAT 甲级 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
2017-10-02 09:43:19 163
原创 PAT 甲级 1065. A+B and C (64bit) (20)
Given three integers A, B and C in [-263, 263], you are supposed to tell whether A+B > C. Input Specification: The first line of the input gives the positive number of test cases, T ( Output
2017-10-02 00:08:58 160
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人