- 博客(27)
- 问答 (1)
- 收藏
- 关注
原创 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 th...
2018-07-30 00:27:49 151
原创 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.Input ...
2018-07-29 22:17:02 87
原创 PAT 1124 Raffle for Weibo Followers(20 分)
John got a full mark on PAT. He was so happy that he decided to hold a raffle(抽奖) for his followers on Weibo -- that is, he would select winners from every N followers who forwarded his post, and give...
2018-07-28 12:39:56 182
原创 PAT 1111 Online Map(30 分)
Input our current position and a destination, an online map can recommend several paths. Now your job is to recommend two paths to your user: one is the shortest, and the other is the fastest. It is g...
2018-07-27 14:56:40 281
原创 PAT 1138 Postorder Traversal(25 分)
Suppose that all the keys in a binary tree are distinct positive integers. Given the preorder and inorder traversal sequences, you are supposed to output the first number of the postorder traversal se...
2018-07-26 17:19:29 207
原创 PAT 1142 Maximal Clique(25 分)
A clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. A maximal clique is a clique that cannot be extended by including one more adj...
2018-07-25 13:19:07 193
原创 PAT 1139 First Contact(30 分)
Unlike in nowadays, the way that boys and girls expressing their feelings of love was quite subtle in the early years. When a boy A had a crush on a girl B, he would usually not contact her directly i...
2018-07-25 12:39:30 406
原创 PAT 1143 Lowest Common Ancestor(30 分)
The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants.A binary search tree (BST) is recursively defined as a binary tree which has ...
2018-07-23 15:04:28 178
原创 PAT 1145 Hashing - Average Search Time(25 分)
The task of this problem is simple: insert a sequence of distinct positive integers into a hash table first. Then try to find another sequence of integer keys from the table and output the average sea...
2018-07-20 15:34:34 342 1
原创 PAT 1146 Topological Order(25 分)
This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order obtained from the given directed graph? Now you are supposed to write a program to test...
2018-07-20 14:06:35 312
原创 PAT 1117 Eddington Number(25 分)
British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, he has even defined an "Eddington number", E -- that is, the maximum integer E such that it is for E ...
2018-07-18 11:38:28 261
原创 PAT 1128 N Queens Puzzle(20 分)
The "eight queens puzzle" is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten each other. Thus, a solution requires that no two queens share the same row, ...
2018-07-18 11:18:49 339
原创 PAT Look-and-say Sequence(20 分)
Look-and-say sequence is a sequence of integers as the following:D, D1, D111, D113, D11231, D112213111, ...where D is in [0, 9] except 1. The (n+1)st number is a kind of description of the nth n...
2018-07-18 10:59:28 293
原创 PAT 1144 The Missing Number(20 分)
Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list.Input Specification:Each input file contains one test case. For each case, the first line giv...
2018-07-18 10:44:25 234
原创 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) ...
2018-07-18 02:15:50 163
原创 PAT 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...
2018-07-18 01:36:38 120
原创 1112 Stucked Keyboard (20)
On a broken keyboard, some of the keys are always stucked. So when you type some sentences, the characters corresponding to those keys will appear repeatedly on screen for k times.Now given a resultin...
2018-07-11 16:28:27 95
原创 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 Mars, resp...
2018-07-11 15:34:22 76
原创 PAT 1137 Final Grading(25 分)
For a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), to be qualified for a certificate, he/she must first obtain no less than 200 points from...
2018-07-10 12:22:30 244
原创 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...
2018-07-10 11:18:22 125
原创 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...
2018-07-09 19:55:10 123
原创 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 test case,...
2018-07-08 23:30:00 146
原创 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...
2018-07-08 14:37:54 117
原创 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 the ...
2018-07-05 00:18:56 100
原创 1092 To Buy or Not to Buy (20)
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...
2018-07-02 22:33:27 102
原创 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 ...
2018-07-02 17:25:57 73
原创 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...
2018-07-01 21:51:31 161
空空如也
VScode扩展宿主意外终止。
2017-12-02
TA创建的收藏夹 TA关注的收藏夹
TA关注的人