
PAT甲级
Joyceyang_999
不断努力,越来越优秀
我好懒……剩的甲级题目没补的等以后有时间再补吧。。明年开始。。
展开
-
甲级PAT 1002 A+B for Polynomials(附解坑说明)
题目: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 eac...原创 2018-07-29 18:45:34 · 696 阅读 · 0 评论 -
甲级PAT1003 Emergency(解坑)
1003Emergency (25)(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 t...原创 2018-07-31 22:31:18 · 1213 阅读 · 4 评论 -
甲级PAT1001 A+B Format
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-07-31 23:58:39 · 197 阅读 · 0 评论 -
甲级 PAT1004 Counting Leaves
1004Counting Leaves (30)(30分)A 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...原创 2018-08-19 19:50:17 · 216 阅读 · 0 评论 -
甲级PAT 1005 Spell It Right
1005Spell 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.Input Specification:Each input ...原创 2018-08-19 20:17:01 · 320 阅读 · 0 评论 -
甲级PAT 1006 Sign In and Sign Out
1006 Sign In and Sign Out (25)(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 ...原创 2018-08-19 21:24:36 · 208 阅读 · 0 评论 -
甲级PAT 1013 Battle Over Cities(用cin始终最后一个测试运行超时来看)
1013 Battle Over Cities (25)(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...原创 2018-08-22 21:36:45 · 846 阅读 · 1 评论 -
甲级PAT 1017 Queueing at Bank(排队模拟)
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...原创 2018-08-27 15:51:29 · 313 阅读 · 0 评论 -
甲级PAT 1007 Maximum Subsequence Sum(给出部分坑的测试情况)
1007 Maximum Subsequence Sum (25)(25 分)Given a sequence of K integers { N~1~, N~2~, ..., N~K~ }. A continuous subsequence is defined to be { N~i~, N~i+1~, ..., N~j~ } where 1 <= i <= j <= K...原创 2018-08-20 16:29:17 · 2676 阅读 · 1 评论 -
甲级PAT1008 Elevator(简单数学)
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-20 16:51:20 · 177 阅读 · 0 评论 -
甲级PAT 1009 Product of Polynomials
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 informa...原创 2018-08-20 18:52:30 · 438 阅读 · 0 评论 -
*甲级PAT 1010 Radix(二分搜索+坑)
1010 Radix (25)(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 ...原创 2018-08-21 15:48:22 · 1542 阅读 · 6 评论 -
甲级PAT 1011 World Cup Betting
1011 World Cup Betting (20)(20 分)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 W...原创 2018-08-21 16:25:04 · 180 阅读 · 0 评论 -
**甲级PAT1014 Waiting in Line (已经通过全部测试,找到一个奇怪的坑但是不知道为什么,跪求大佬回复)
1014 Waiting in Line (30)(30 分)Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customer...原创 2018-08-24 17:31:47 · 2296 阅读 · 2 评论 -
甲级PAT 1015 Reversible Primes(大量素数经典方法+二分查找)
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 a pr...原创 2018-08-24 19:15:17 · 279 阅读 · 0 评论 -
*甲级PAT 1012 The Best Rank
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-21 23:06:26 · 245 阅读 · 4 评论 -
甲级PAT 1016 Phone Bills(这是到目前为止甲级写的最长最复杂的代码,其实并不难,逻辑理顺了就好)
1016 Phone Bills(25 分)A long-distance telephone company charges its customers by the following rules:Making a long-distance call costs a certain amount per minute, depending on the time of day whe...原创 2018-08-25 19:32:46 · 1333 阅读 · 0 评论 -
甲级PAT 1070 Mooncake (排序+贪心)
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 ...原创 2018-09-16 19:03:55 · 770 阅读 · 0 评论 -
甲级PAT 1033 To Fill or Not to Fill (贪心)
1033 To Fill or Not to Fill (25 分)With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the...原创 2018-09-16 23:42:14 · 2588 阅读 · 1 评论 -
**甲级PAT 1018 Public Bike Management(Dijkstra+dfs)
1018 Public Bike Management (30 分)There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any station and ret...原创 2018-09-17 15:50:18 · 205 阅读 · 0 评论 -
甲级PAT 1025 PAT Ranking(排序,成绩排序模拟)
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 pla...原创 2018-09-10 15:56:56 · 338 阅读 · 0 评论 -
甲级PAT 1041 Be Unique(散列)
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]. Th...原创 2018-09-10 16:12:24 · 214 阅读 · 0 评论 -
甲级PAT1020 Tree Traversals (树的后序和中序转树的层序)
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 ...原创 2018-09-23 21:32:57 · 249 阅读 · 0 评论 -
甲级PAT 1021 Deepest Root(dfs+二维vector)
1021 Deepest Root (25 分)A graph which is connected and acyclic can be considered a tree. The hight of the tree depends on the selected root. Now you are supposed to find the root that results in a h...原创 2018-09-24 07:47:23 · 215 阅读 · 0 评论 -
甲级PAT 1027 Colors in Mars(十进制转十三进制)
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 a...原创 2018-09-24 13:37:15 · 384 阅读 · 0 评论 -
甲级PAT 1019 General Palindromic Number (回文数)
1019 General Palindromic Number (20 分)A 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 sing...原创 2018-09-19 23:44:42 · 216 阅读 · 0 评论 -
**甲级PAT 1022 Digital Library (map映射)
1022 Digital Library (30 分)A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assign...原创 2018-09-26 07:31:52 · 235 阅读 · 0 评论 -
甲级PAT 1028 List Sorting(sort排序)
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, t...原创 2018-09-26 07:57:29 · 276 阅读 · 0 评论 -
甲级PAT 1024 Palindromic Number(回文数+大数加法)
1024 Palindromic Number (25 分)A 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...原创 2018-09-22 18:06:16 · 338 阅读 · 0 评论 -
甲级PAT 1023 Have Fun with Numbers(大数乘法+散列)
1023 Have Fun with Numbers (20 分)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 happe...原创 2018-09-22 19:27:58 · 206 阅读 · 0 评论 -
*甲级PAT 1030 Travel Plan(DFS+Dijkstra 同1018)
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 d...原创 2018-10-06 21:21:17 · 215 阅读 · 0 评论 -
甲级PAT 1031 Hello World for U (20 分)(图形输出)
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 ...原创 2018-10-15 21:44:36 · 271 阅读 · 0 评论 -
PAT甲级 1034 Head of a Gang (30 分)(图的dfs遍历,map映射)
1034 Head of a Gang (30 分)One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a...原创 2018-11-22 13:23:10 · 487 阅读 · 0 评论 -
甲级PAT 1035 Password (20 分) (字符串替换)
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 distingu...原创 2018-11-22 18:21:00 · 190 阅读 · 0 评论 -
甲级PAT 1036 Boys vs Girls (25 分)(排序)
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:Eac...原创 2018-11-22 18:26:52 · 154 阅读 · 0 评论 -
PAT甲级 1037 Magic Coupon (25 分)(贪心)
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 t...原创 2018-11-22 18:44:10 · 237 阅读 · 0 评论 -
甲级PAT 1038 Recover the Smallest Number (30 分)(贪心)
1038 Recover the Smallest Number (30 分)Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given { 32, 321, 3214, 0229, 87 }, we can recove...原创 2018-11-24 14:39:57 · 163 阅读 · 0 评论 -
甲级PAT 1039 Course List for Student (25 分)(map、散列、set)
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 co...原创 2018-11-24 16:53:59 · 172 阅读 · 0 评论 -
甲级PAT 1042 Shuffling Machine (20 分)(简单模拟)
1042 Shuffling Machine (20 分)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 emp...原创 2018-11-24 18:01:53 · 224 阅读 · 0 评论 -
甲级PAT 1040 Longest Symmetric String (25 分)(贪心)
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...原创 2018-11-26 08:07:29 · 242 阅读 · 0 评论