浙大PAT-A题目集
Vincent's Blog
A bug machine made in HUST
展开
-
PAT-A 1015. Reversible Primes
1015. Reversible PrimesA 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 r原创 2016-08-03 20:07:39 · 274 阅读 · 0 评论 -
PAT-A 1027. Colors in Mars
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 digi原创 2016-07-31 23:14:29 · 255 阅读 · 0 评论 -
PAT-A 1005. Spell It Right
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. Each cas原创 2016-07-31 22:55:15 · 249 阅读 · 0 评论 -
PAT-A 1100. Mars Numbers
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, re原创 2016-07-31 23:30:50 · 410 阅读 · 0 评论 -
PAT-A 1093. Count PAT's
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 second one is formed by the 3rd, the 4th, and the 6th characters.Now giv原创 2016-07-31 23:29:07 · 352 阅读 · 0 评论 -
PAT-A 1092. To Buy or Not to Buy
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 sell原创 2016-07-31 23:27:54 · 317 阅读 · 0 评论 -
PAT-A 1084. Broken Keyboard
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 ty原创 2016-07-31 23:26:02 · 252 阅读 · 0 评论 -
PAT-A 1083. List Grades
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 a原创 2016-07-31 23:24:51 · 239 阅读 · 0 评论 -
PAT-A 1058. A+B in Hogwarts
If you are a fan of Harry Potter, you would know the world of magic has its own currency system – as Hagrid explained it to Harry, “Seventeen silver Sickles to a Galleon and twenty-nine Knuts to a Sick原创 2016-07-31 23:23:15 · 287 阅读 · 0 评论 -
PAT-A 1049. Counting Ones
The task is simple: given any positive integer N, you are supposed to count the total number of 1’s in the decimal form of the integers from 1 to N. For example, given N being 12, there are five 1’s in原创 2016-08-01 13:07:11 · 598 阅读 · 0 评论 -
PAT-A 1035. Password
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 (L i原创 2016-08-01 14:57:39 · 305 阅读 · 0 评论 -
PAT-A 1078. Hashing
1078. HashingThe 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(原创 2016-08-14 17:28:14 · 448 阅读 · 0 评论 -
PAT-A 1090. Highest Price in Supply Chain
1090. Highest Price in Supply ChainA supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)– everyone involved in moving a product from supplier to customer.Starting from on原创 2016-08-14 17:20:05 · 281 阅读 · 0 评论 -
PAT-A 1064. Complete Binary Search Tree
1064. Complete Binary Search TreeA 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 tha原创 2016-08-14 10:04:04 · 351 阅读 · 0 评论 -
PAT-A 1009. Product of Polynomials
1009. Product of PolynomialsThis 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 li原创 2016-08-13 21:06:24 · 581 阅读 · 0 评论 -
PAT-A 1002.A+B for Polynomials
1002. A+B for PolynomialsThis time, you are supposed to find A+B where A and B are two polynomials.InputEach input file contains one test case. Each case occupies 2 lines, and each line contains the in原创 2016-08-13 20:25:48 · 356 阅读 · 0 评论 -
PAT-A 1004.Counting Leaves
1004. Counting LeavesA family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. InputEach input file contains one test case. Each case sta原创 2016-08-13 18:24:05 · 484 阅读 · 0 评论 -
PAT-A 1094. The Largest Generation
1094. The Largest GenerationA 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原创 2016-08-13 17:24:38 · 312 阅读 · 0 评论 -
PAt-A 1065. A+B and C(64bit)
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 (<=10). Then T test c原创 2016-08-01 15:00:09 · 273 阅读 · 0 评论 -
PAT-A 1042. Shuffling Machine
Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid “inside jobs” where employees collaborate with gamblers原创 2016-07-31 23:22:04 · 279 阅读 · 0 评论 -
PAT-A 1041. Be Unique
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 bets on a原创 2016-07-31 23:19:51 · 242 阅读 · 0 评论 -
PAT-A 1024. Palindromic Number
1024. Palindromic NumberA number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers原创 2016-08-04 11:17:32 · 264 阅读 · 0 评论 -
PAT-A 1019. General Palindromic Number
1019. General Palindromic NumberA number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit原创 2016-08-03 23:10:00 · 248 阅读 · 0 评论 -
PAT-A 1048. Find Coins
1048. Find CoinsEva 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 pay原创 2016-08-03 20:42:13 · 310 阅读 · 0 评论 -
PAT-A 1037. Magic Coupon
1037. Magic CouponThe 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原创 2016-08-03 20:38:44 · 244 阅读 · 0 评论 -
PAT-A 1099. Build A Binary Search Tree
1099. Build A Binary Search TreeA 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原创 2016-08-03 20:25:18 · 340 阅读 · 0 评论 -
PAT-A 1085. Perfect Sequence
1085. Perfect SequenceGiven a sequence of positive integers and another positive integer p. The sequence is said to be a “perfect sequence” if M <= m * p where M and m are the maximum and minimum numbe原创 2016-08-03 20:19:45 · 305 阅读 · 0 评论 -
PAT-A 1081.Rational Sum
1081. Rational SumGiven 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原创 2016-08-03 20:15:20 · 300 阅读 · 0 评论 -
PAT-A 1069. The Black Hole of Numbers
1069. The Black Hole of NumbersFor 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 n原创 2016-08-03 20:12:11 · 295 阅读 · 0 评论 -
PAT-A 1001. A+B Format
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).InputEach input file contains one t原创 2016-07-31 22:53:38 · 319 阅读 · 0 评论 -
PAT-A 1006. Sign In and Sign Out
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, you原创 2016-07-31 22:58:27 · 271 阅读 · 0 评论 -
PAT-A 1036. Boys vs Girls
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 test c原创 2016-07-31 23:18:25 · 272 阅读 · 0 评论 -
PAT-A 1031. Hello World for U
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 printed原创 2016-07-31 23:17:00 · 221 阅读 · 0 评论 -
PAT-A 1029. Median
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} is 15. The原创 2016-07-31 23:15:42 · 281 阅读 · 0 评论 -
PAT-A 1023. Have Fun with Numbers
Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number cons原创 2016-07-31 23:13:20 · 248 阅读 · 0 评论 -
PAT-A 1020. Tree Traversals
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 corr原创 2016-07-31 23:07:03 · 263 阅读 · 0 评论 -
PAT-A 1011. World Cup Betting
With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Sim原创 2016-07-31 23:02:50 · 262 阅读 · 0 评论 -
PAT-A 1008. Elevator
The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seco原创 2016-07-31 23:01:11 · 289 阅读 · 0 评论 -
PAT-A 1007. Maximum Subsequence Sum
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 subsequence which has t原创 2016-07-31 23:00:08 · 243 阅读 · 0 评论 -
PAT-A 1088. Rational Arithmetic
1088. Rational ArithmeticFor 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原创 2016-08-14 17:34:18 · 304 阅读 · 0 评论