PAT甲级题
galesaur_wcy
我们一起加油啊~~~~
展开
-
1140 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-24 10:12:51 · 752 阅读 · 0 评论 -
1136 A Delayed Palindrome(20 分)
Consider a positive integer N written in standard notation with k+1 digits ai as ak⋯a1a0 with 0≤ai<10 for all i and ak>0. Then N is palindromic if and only if ai=ak−i for...原创 2018-07-24 11:17:00 · 353 阅读 · 0 评论 -
1132 Cut Integer(20 分)
Cutting an integer means to cut a K digits lone integer Z into two integers of (K/2) digits long integers A and B. For example, after cutting Z = 167334, we have A = 167 and B = 334. It is interesting...原创 2018-07-25 11:23:48 · 372 阅读 · 0 评论 -
1031 Hello World for U (20)(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 b...原创 2018-07-20 20:42:11 · 457 阅读 · 0 评论 -
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-27 11:29:47 · 325 阅读 · 2 评论 -
1139 First Contact(30 分)
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 ...原创 2018-08-09 10:11:35 · 1108 阅读 · 11 评论 -
1147 Heaps(30 分)
1147 Heaps(30 分)In computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the value) of P is either greater t...原创 2018-08-09 11:35:40 · 698 阅读 · 0 评论 -
1073 Scientific Notation (20)(20 分)
1073 Scientific Notation (20)(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...转载 2018-08-09 15:32:22 · 355 阅读 · 0 评论 -
1141 PAT Ranking of Institutions(25 分)
After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the ranklist.Input Specification:Each input file conta...原创 2018-08-05 16:22:42 · 177 阅读 · 0 评论 -
1142 Maximal Clique(25 分)
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 extende...原创 2018-08-05 18:42:01 · 168 阅读 · 0 评论 -
1012 The Best Rank (25)(25 分)
1012 The Best Rank (25)(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 ...原创 2018-08-09 19:49:14 · 373 阅读 · 2 评论 -
1117 Eddington Number(25 分)
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 int...原创 2018-08-09 20:31:24 · 825 阅读 · 0 评论 -
1118 Birds in Forest(25 分)
1118 Birds in Forest(25 分)Some scientists took pictures of thousands of birds in a forest. Assume that all the birds appear in the same picture belong to the same tree. You are supposed to help the ...原创 2018-08-09 20:56:59 · 253 阅读 · 0 评论 -
1121 Damn Single(25 分)
1121 Damn Single(25 分)"Damn Single (单身狗)" is the Chinese nickname for someone who is being single. You are supposed to find those who are alone in a big party, so they can be taken care of.Input S...原创 2018-08-09 21:30:52 · 777 阅读 · 0 评论 -
1122 Hamiltonian Cycle(25 分)
1122 Hamiltonian Cycle(25 分)The "Hamilton cycle problem" is to find a simple cycle that contains every vertex in a graph. Such a cycle is called a "Hamiltonian cycle".In this problem, you are supp...原创 2018-08-09 21:40:05 · 949 阅读 · 0 评论 -
1143. Lowest Common Ancestor (30)
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 ...转载 2018-08-06 12:45:22 · 133 阅读 · 0 评论 -
1035 Password (20)(20 分)
1035 Password (20)(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 dist...原创 2018-08-06 12:47:21 · 125 阅读 · 0 评论 -
1001 A+B Format (20 分)
1001 A+B Format (20)(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).Inp...原创 2018-08-06 12:49:11 · 683 阅读 · 0 评论 -
1002 A+B for Polynomials (25)(25 分)
1002 A+B for Polynomials (25)(25 分)This 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 lin...原创 2018-08-06 12:50:32 · 507 阅读 · 0 评论 -
1005 Spell It Right (20)(20 分)
1005 Spell It Right (20)(20 分)1005 Spell It Right (20)(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.I...原创 2018-08-06 12:51:42 · 151 阅读 · 0 评论 -
1008 Elevator (20)(20 分)
1008 Elevator (20)(20 分)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 speci...原创 2018-08-06 12:52:32 · 241 阅读 · 0 评论 -
1015 Reversible Primes (20)(20 分)
1015 Reversible Primes (20)(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 ...原创 2018-08-06 12:54:26 · 515 阅读 · 0 评论 -
1116 Come on! Let's C(20 分)
1116 Come on! Let's C(20 分)"Let's C" is a popular and fun programming contest hosted by the College of Computer Science and Technology, Zhejiang University. Since the idea of the contest is for fun,...原创 2018-08-06 12:58:00 · 151 阅读 · 0 评论 -
1120 Friend Numbers(20 分)
1120 Friend Numbers(20 分)Two integers are called "friend numbers" if they share the same sum of their digits, and the sum is their "friend ID". For example, 123 and 51 are friend numbers since 1+2+3...原创 2018-08-06 12:58:45 · 178 阅读 · 0 评论 -
1124 Raffle for Weibo Followers(20 分)
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 fol...原创 2018-08-08 09:57:22 · 280 阅读 · 0 评论 -
1144 The Missing Number(20 分)
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. Fo...原创 2018-08-08 09:57:53 · 189 阅读 · 0 评论 -
1146 Topological Order(25 分)
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 suppo...原创 2018-08-08 09:57:42 · 254 阅读 · 0 评论 -
1041 Be Unique (20)(20 分)
1041 Be Unique (20)(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, 10^4^...原创 2018-08-08 09:57:36 · 159 阅读 · 0 评论 -
1061 Dating (20)(20 分)
1061 Dating (20)(20 分)Sherlock Holmes received a note with some strange strings: "Let's date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm". It took him only a minute to figure out ...原创 2018-08-10 14:37:50 · 685 阅读 · 0 评论 -
1063 Set Similarity (25)(25 分)
1063 Set Similarity (25)(25 分)Given two sets of integers, the similarity of the sets is defined to be N~c~/N~t~*100%, where N~c~ is the number of distinct common numbers shared by the two sets, and ...原创 2018-08-10 18:10:41 · 131 阅读 · 0 评论 -
1064 Complete Binary Search Tree (30)(30 分)
1064 Complete Binary Search Tree (30)(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...转载 2018-08-10 18:51:03 · 729 阅读 · 0 评论 -
1065 A+B and C (64bit) (20)(20 分)
1065 A+B and C (64bit) (20)(20 分)Given three integers A, B and C in [-2^63^, 2^63^], you are supposed to tell whether A+B > C.Input Specification:The first line of the input gives the positiv...原创 2018-08-10 19:25:34 · 158 阅读 · 0 评论 -
1093 Count PAT's (25)(25 分)
1093 Count PAT's (25)(25 分)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, ...原创 2018-08-10 19:46:20 · 307 阅读 · 0 评论 -
1092 To Buy or Not to Buy (20)(20 分)
1092 To Buy or Not to Buy (20)(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. Howeve...原创 2018-08-10 19:58:47 · 421 阅读 · 0 评论 -
1094 The Largest Generation (25)(25 分)
1094 The Largest Generation (25)(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 generat...原创 2018-08-10 20:20:05 · 279 阅读 · 0 评论 -
1069 The Black Hole of Numbers (20)(20 分)
1069 The Black Hole of Numbers (20)(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 o...原创 2018-08-10 20:44:09 · 18102 阅读 · 0 评论 -
1039 Course List for Student (25)(25 分)
1039 Course List for Student (25)(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 registere...原创 2018-08-10 21:41:38 · 276 阅读 · 0 评论 -
1057 Stack (30)(30 分)
1057 Stack (30)(30 分)Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element onto t...转载 2018-08-14 15:38:08 · 322 阅读 · 0 评论 -
1058 A+B in Hogwarts (20)(20 分)
1058 A+B in Hogwarts (20)(20 分)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 Gall...原创 2018-08-14 15:47:07 · 270 阅读 · 0 评论 -
1070 Mooncake (25)(25 分)
1070 Mooncake (25)(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 ...原创 2018-08-11 11:18:33 · 259 阅读 · 0 评论