
PAT甲级(Advanced Level)
xiaoshengMr
这个作者很懒,什么都没留下…
展开
-
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 stack原创 2017-11-11 14:45:02 · 242 阅读 · 0 评论 -
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 ...原创 2019-02-22 22:40:30 · 223 阅读 · 0 评论 -
1010 Radix (25 分)
Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is yes, if 6 is a decimal number and 110 is a binary number.Now for any pair of positive inte...原创 2019-02-23 17:38:30 · 240 阅读 · 0 评论 -
1136 A Delayed Palindrome (20 分)
Consider a positive integerNwritten in standard notation withk+1digitsaiasak⋯a1a0with0≤ai<10for alliandak>0. ThenNispalindromicif and only ifai=ak−ifor...原创 2019-03-01 12:48:36 · 157 阅读 · 0 评论 -
1009 Product of Polynomials (25 分)
This time, you are supposed to findA×BwhereAandBare two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the informa...原创 2019-03-01 16:27:54 · 136 阅读 · 0 评论 -
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 forktimes.Now given a result...原创 2019-03-05 11:19:53 · 162 阅读 · 0 评论 -
1108 Finding Average (20 分)
The basic task is simple: givenNreal numbers, you are supposed to calculate their average. But what makes it complicated is that some of the input numbers might not be legal. Alegalinput is a real...原创 2019-03-05 15:19:46 · 253 阅读 · 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 ...原创 2019-03-02 10:33:23 · 514 阅读 · 1 评论 -
1106 Lowest Price in Supply Chain (25 分)
1106Lowest 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.Start...原创 2019-03-02 10:50:44 · 171 阅读 · 0 评论 -
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 to...原创 2019-03-05 16:45:37 · 356 阅读 · 0 评论 -
1053 Path of Equal Weight (30 分)
Given a non-empty tree with rootR, and with weightWiassigned to each tree nodeTi. Theweight of a path fromRtoLis defined to be the sum of the weights of all the nodes along the path fro...原创 2019-03-02 14:23:45 · 164 阅读 · 0 评论 -
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. Asocial clusteris a set of people who have some of thei...原创 2019-03-03 14:26:49 · 241 阅读 · 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 nee...原创 2019-02-27 11:19:43 · 182 阅读 · 0 评论 -
1024 Palindromic Number (25 分)
A number that will be the same when it is written forwards or backwards is known as aPalindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers...原创 2019-03-04 11:24:47 · 197 阅读 · 0 评论 -
1128 N Queens Puzzle (20 分)
The "eight queens puzzle" is the problem of placing eight chess queens on an8×8chessboard so that no two queens threaten each other. Thus, a solution requires that no two queens share the same row, ...原创 2019-03-04 13:19:19 · 140 阅读 · 0 评论 -
1012 The Best Rank (25 分)
To evaluate the performance of our first year CS majored students, we consider their grades of three courses only:C- C Programming Language,M- Mathematics (Calculus or Linear Algrbra), andE- Eng...原创 2019-03-04 14:33:59 · 163 阅读 · 0 评论 -
1052 Linked List Sorting (25 分)
A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integerkeyand aNextpointer to the next structure. Now give...原创 2019-03-04 15:58:35 · 162 阅读 · 0 评论 -
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 ...原创 2019-02-27 15:10:40 · 131 阅读 · 0 评论 -
Boys vs Girls (25)
Boys vs Girls (25)时间限制 1000 ms 内存限制 65536 KB 代码长度限制 100 KB 判断程序 Standard (来自 小小) 题目描述 This time you are asked to tell the difference between the lowest grade of all the male students and the highe...原创 2018-05-15 23:36:33 · 406 阅读 · 0 评论 -
Password (20)
Password (20)时间限制 1000 ms 内存限制 65536 KB 代码长度限制 100 KB 判断程序 Standard (来自 小小) 题目描述 To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there ...原创 2018-05-15 23:32:10 · 285 阅读 · 0 评论 -
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 prove原创 2017-11-11 16:18:50 · 245 阅读 · 0 评论 -
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 u原创 2017-11-20 16:44:25 · 237 阅读 · 0 评论 -
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-11-22 09:09:53 · 225 阅读 · 0 评论 -
The Dominant Color (20)
The Dominant Color (20)时间限制 1000 ms 内存限制 65536 KB 代码长度限制 100 KB 判断程序 Standard (来自 小小) 题目描述 Behind the scenes in the computer’s memory, color is always talked about as a series of 24 bits of inform...原创 2018-04-30 23:13:05 · 181 阅读 · 0 评论 -
Spell It Right (20)
Spell It Right (20)时间限制 1000 ms 内存限制 32768 KB 代码长度限制 100 KB 判断程序 Standard (来自 小小) 题目描述 Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digi...原创 2018-05-01 23:32:11 · 178 阅读 · 0 评论 -
Colors in Mars (20)
Colors in Mars (20)时间限制 1000 ms 内存限制 65536 KB 代码长度限制 100 KB 判断程序 Standard (来自 小小) 题目描述 People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a colo...原创 2018-05-02 22:30:15 · 194 阅读 · 0 评论 -
A+B for Polynomials (25)
A+B for Polynomials (25)时间限制 1000 ms 内存限制 32768 KB 代码长度限制 100 KB 判断程序 Standard (来自 小小) 题目描述 This time, you are supposed to find A+B where A and B are two polynomials.输入描述: Each input file conta...原创 2018-05-03 23:03:25 · 349 阅读 · 0 评论 -
Elevator (20)
Elevator (20)时间限制 1000 ms 内存限制 32768 KB 代码长度限制 100 KB 判断程序 Standard (来自 小小) 题目描述 The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numb...原创 2018-05-10 23:04:49 · 184 阅读 · 0 评论 -
Median (25)
Median (25)时间限制 1000 ms 内存限制 65536 KB 代码长度限制 100 KB 判断程序 Standard (来自 小小) 题目描述 Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the medi...原创 2018-05-17 23:21:34 · 223 阅读 · 0 评论 -
Magic Coupon (25)
Magic Coupon (25)时间限制 1000 ms 内存限制 65536 KB 代码长度限制 100 KB 判断程序 Standard (来自 小小) 题目描述 The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning tha...原创 2018-05-18 11:09:03 · 248 阅读 · 0 评论 -
Maximum Subsequence Sum (25)
Maximum Subsequence Sum (25)时间限制 1000 ms 内存限制 32768 KB 代码长度限制 100 KB 判断程序 Standard (来自 小小) 题目描述 Given a sequence of K integers { N1, N2, …, NK }. A continuous subsequence is defined to be { Ni, N...原创 2018-05-12 23:07:40 · 237 阅读 · 0 评论 -
Sign In and Sign Out (25)
Sign In and Sign Out (25)时间限制 1000 ms 内存限制 32768 KB 代码长度限制 100 KB 判断程序 Standard (来自 小小) 题目描述 At the beginning of every day, the first person who signs in the computer room will unlock the door, an...原创 2018-05-13 23:07:18 · 239 阅读 · 0 评论 -
A1081 Rational Sum (20)
时间限制 1000 ms 内存限制 65536 KB 代码长度限制 100 KB 判断程序 Standard (来自 小小)题目描述 Given N rational numbers in the form “numerator/denominator”, you are supposed to calculate their sum.输入描述: Each input file con...原创 2018-04-28 22:53:54 · 253 阅读 · 0 评论 -
A1001 A+B Format (20)
A+B Format (20) 时间限制 1000 ms 内存限制 32768 KB 代码长度限制 100 KB 判断程序 Standard (来自 小小) 题目描述 Calculate a + b and output the sum in standard format – that is, the digits must be separated into groups of thre...原创 2018-04-29 16:31:54 · 144 阅读 · 0 评论 -
List Grades (25)
List Grades (25)时间限制 1000 ms 内存限制 65536 KB 代码长度限制 100 KB 判断程序 Standard (来自 小小) 题目描述 Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to...原创 2018-04-29 23:03:21 · 260 阅读 · 0 评论 -
List Sorting (25)
List Sorting (25)时间限制 1000 ms 内存限制 65536 KB 代码长度限制 100 KB 判断程序 Standard (来自 小小) 题目描述 Excel can sort records according to any column. Now you are supposed to imitate this function.输入描述: Each in...原创 2018-05-14 23:35:18 · 256 阅读 · 0 评论 -
1105 Spiral Matrix (25 分)
1105Spiral Matrix(25 分)This time your job is to fill a sequence ofNpositive integers into aspiral matrixin non-increasing order. A spiral matrix is filled in from the first element at the uppe...原创 2019-03-04 17:03:52 · 130 阅读 · 0 评论