
PAT
PAT甲级
tina竹
这个作者很懒,什么都没留下…
展开
-
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 thanthe node’s key.The right subtree of a node contains only nodes with keys grea原创 2020-06-22 15:35:20 · 242 阅读 · 0 评论 -
PAT 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 thanthe node’s key.The right subtree of a node contains only nodes with keys grea原创 2020-06-19 17:02:04 · 239 阅读 · 0 评论 -
PAT 1040 Longest Symmetric String (25分)
题目:Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given Is PAT&TAP symmetric?, the longest symmetric sub-string is s PAT&TAP s, hence ...原创 2020-02-06 12:58:15 · 134 阅读 · 0 评论 -
PAT 1039 Course List for Student (25分)
题目:Zhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses, you are supposed to output the registered course list for each student who co...原创 2020-02-05 18:12:03 · 135 阅读 · 0 评论 -
PAT 1041 Be Unique (20分)
题目:Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1,104]. The first one who be...原创 2020-02-04 19:09:27 · 118 阅读 · 0 评论 -
PAT 1037 Magic Coupon (25分)
题目:The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when you use this coupon with a product, you may get N times the value of that produ...原创 2020-02-03 20:23:03 · 123 阅读 · 0 评论 -
PAT 1036 Boys vs Girls (25分)
题目:This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.Input Specification:Each input file contains one...原创 2020-02-03 16:49:27 · 106 阅读 · 0 评论 -
PAT 1035 Password (20分)
题目:To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l...原创 2020-02-03 16:14:07 · 117 阅读 · 0 评论 -
PAT 1032 Sharing (25分)
题目:To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same suffix. For exam...原创 2020-01-30 18:31:42 · 173 阅读 · 0 评论 -
PAT 1031 Hello World for U (20分)
题目:Given any string of N (≥5) characters, you are asked to form the characters into the shape of U. For example, helloworld can be printed as:h de ll rlowoThat is, the characters must be prin...原创 2020-01-30 15:36:12 · 155 阅读 · 0 评论 -
PAT 1030 Travel Plan (30分)
题目:A traveler’s map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide the shortest pa...原创 2020-01-30 13:57:00 · 110 阅读 · 0 评论 -
PAT 1029 Median (25分)
题目:Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1 = { 11, 12, 13, 14 } is 12, and the median of S2 = { 9, 10, 15, 16, 17 ...原创 2020-01-29 15:27:28 · 131 阅读 · 0 评论 -
PAT 1028 List Sorting (25分)
题目:Excel can sort records according to any column. Now you are supposed to imitate this function.Input Specification:Each input file contains one test case. For each case, the first line contains t...原创 2020-01-29 14:24:17 · 137 阅读 · 0 评论 -
PAT 1027 Colors in Mars (20分)
题目:People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digits are for Red, the middle 2...原创 2020-01-29 12:24:52 · 172 阅读 · 0 评论 -
1025 PAT Ranking (25分)
题目:Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ranklis...原创 2020-01-28 17:52:07 · 139 阅读 · 0 评论 -
PAT 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 r...原创 2020-01-20 17:34:07 · 158 阅读 · 0 评论 -
PAT 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...原创 2020-01-17 22:05:16 · 94 阅读 · 0 评论 -
PAT 1017 Queueing at Bank (25分)
题目:Suppose a bank has K windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. All the customers have to wait in line behind the yello...原创 2020-01-16 20:50:29 · 143 阅读 · 0 评论 -
PAT 1015 Reversible Primes (20分)
题目:A reversible prime in any number system is a prime whose “reverse” in that number system is also a prime. For example in the decimal system 73 is a reversible prime because its reverse 37 is also ...原创 2020-01-13 18:39:05 · 90 阅读 · 0 评论 -
PAT 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...原创 2020-01-11 23:30:22 · 89 阅读 · 0 评论 -
PAT 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), and E -...原创 2020-01-11 17:53:00 · 114 阅读 · 0 评论 -
PAT 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 i...原创 2020-01-10 11:17:12 · 168 阅读 · 0 评论 -
PAT 1009 Product of Polynomials (25分)
题目:This time, you are supposed to find A×B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the infor...原创 2020-01-09 10:42:52 · 122 阅读 · 0 评论 -
PAT 1007 Maximum Subsequence Sum (25分)
题目:Given a sequence of K integers { N1, N2, …, NK }. A continuous subsequence is defined to be { Ni, Ni+1, …, Nj } where 1≤i≤j≤K. The Maximum Subsequence is the continuous subsequen...原创 2020-01-07 18:20:47 · 84 阅读 · 0 评论 -
PAT 1006 Sign In and Sign Out (25分)
题目:At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in’s and out’s,...原创 2020-01-07 12:03:39 · 89 阅读 · 0 评论 -
PAT 1005 Spell It Right (20分)
题目:Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input file contains one test case. E...原创 2020-01-06 19:39:33 · 114 阅读 · 0 评论 -
PAT 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 t...原创 2020-01-06 18:13:16 · 144 阅读 · 0 评论 -
1002 A+B for Polynomials (25分)
题目:This time, you are supposed to find A+B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the infor...原创 2020-01-05 16:18:29 · 128 阅读 · 0 评论 -
PAT 1001 A+B Format (20分)
题目:Calculate a+b and output the sum in standard format – that is, the digits must be separated into groups of three by commas (unless there are less than four digits).Input Specification:Each input...原创 2020-01-04 21:15:15 · 84 阅读 · 0 评论 -
LeetCode:1305. 两棵二叉搜索树中的所有元素
题目描述:给你 root1 和 root2 这两棵二叉搜索树。请你返回一个列表,其中包含 两棵树 中的所有整数并按 升序 排序。.示例 1:输入:root1 = [2,1,4], root2 = [1,0,3]输出:[0,1,1,2,3,4]示例 2:输入:root1 = [0,-10,10], root2 = [5,1,7,0,2]输出:[-10,0,0,1,2,5,7,10]...原创 2020-01-03 22:14:39 · 257 阅读 · 0 评论