![](https://img-blog.csdnimg.cn/20200911112223581.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
PAT甲级
文章平均质量分 56
浙大计算机能力测试,在刷题中提升自己!
繁星蓝雨
Happy coding!
展开
-
PAT甲【所有题目+解析+代码示例+总结】附带所有历年整体+讲解+代码
PAT (Advanced Level) Practice题目总结1001 A+B Format字符串处理1002 1002 A+B for Polynomials (25 分)简单模拟1003 Emergency (25分)——Dijkstra(邻接表、邻接矩阵)、Bellman_Ford、SPFA最短路径1004 Counting Leaves (...原创 2020-03-03 09:56:03 · 2266 阅读 · 0 评论 -
1001 A+B Format (20 分)————字符串处理
文章目录1 题目2 参考代码:1 题目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 f...原创 2020-03-03 08:20:25 · 253 阅读 · 0 评论 -
1029 Median (25分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目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 }...原创 2020-03-01 10:52:36 · 227 阅读 · 0 评论 -
1070 Mooncake (25分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目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 trad...原创 2020-03-01 09:50:14 · 333 阅读 · 0 评论 -
1024 Palindromic Number (25分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目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 p...原创 2020-03-01 09:26:41 · 248 阅读 · 0 评论 -
1023 Have Fun with Numbers (20分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目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...原创 2020-03-01 08:30:28 · 278 阅读 · 0 评论 -
1059 Prime Factors (25分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目1059 Prime Factors (25分)Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1k1 ×p2k2 ×⋯×p...原创 2020-02-29 20:45:36 · 316 阅读 · 0 评论 -
1096 Consecutive Factors (20分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目1096 Consecutive Factors (20分)Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3×5×...原创 2020-02-29 16:53:53 · 257 阅读 · 0 评论 -
1078 Hashing (25分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目1078 Hashing (25分)The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input num...原创 2020-02-29 12:52:57 · 246 阅读 · 0 评论 -
1015 Reversible Primes (20分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目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 s...原创 2020-02-29 09:57:45 · 402 阅读 · 0 评论 -
1081 Rational Sum (20分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目1081 Rational Sum (20分)Given N rational numbers in the form numerator/denominator, you are supposed to calculate their sum.Input Specification:Each input file c...原创 2020-02-28 21:35:29 · 225 阅读 · 0 评论 -
1088 Rational Arithmetic (20分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目1088 Rational Arithmetic (20分)For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and ...原创 2020-02-28 21:13:09 · 266 阅读 · 0 评论 -
1022 Digital Library (30分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目1022 Digital Library (30分)A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and p...原创 2020-02-28 00:06:58 · 230 阅读 · 0 评论 -
1071 Speech Patterns (25分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目1071 Speech Patterns (25分)People often have a preference among synonyms of the same word. For example, some may prefer “the police”, while others may prefer “the ...原创 2020-02-27 22:38:44 · 283 阅读 · 0 评论 -
1054 The Dominant Color (20分)
文章目录1 题目2 解析2.1 题意2.2 思路2.2.1 思路一(map数组)2.2.2 思路二(不用map数组)3 参考代码3.1思路一3.2 思路二1 题目1054 The Dominant Color (20分)Behind the scenes in the computer’s memory, color is always talked about as a series o...原创 2020-02-27 20:28:48 · 247 阅读 · 0 评论 -
1100 Mars Numbers (20分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目1100 Mars Numbers (20分)People on Mars count their numbers with base 13:Zero on Earth is called “tret” on Mars.The numbers 1 to 12 on Earth is called “jan, feb, ...原创 2020-02-27 18:56:19 · 298 阅读 · 0 评论 -
1060 Are They Equal (25分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目1060 Are They Equal (25分)If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0....原创 2020-02-27 16:08:02 · 217 阅读 · 0 评论 -
1063 Set Similarity (25分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目1063 Set Similarity (25分)Given two sets of integers, the similarity of the sets is defined to be Nc /Nt ×100%, where Nc is the number of distinct common n...原创 2020-02-27 12:17:12 · 267 阅读 · 0 评论 -
1047 Student List for Course (25分)
文章目录1 题目2 解析2.1 题意2.2 思路2.2.1 思路一2.2.2 思路二3 参考代码3.1 思路一(用vector<\string>)3.2 思路二(char二维数组)1 题目1047 Student List for Course (25分)Zhejiang University has 40,000 students and provides 2,500 co...原创 2020-02-27 10:28:43 · 230 阅读 · 0 评论 -
1039 Course List for Student (25分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目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 s...原创 2020-02-27 09:45:08 · 272 阅读 · 0 评论 -
1026 Table Tennis (30分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目1026 Table Tennis (30分)A table tennis club has N tables available to the public. The tables are numbered from 1 to N. For any pair of players, if there are some t...原创 2020-02-27 00:03:05 · 364 阅读 · 0 评论 -
1014 Waiting in Line (30分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目1014 Waiting in Line (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 pa...原创 2020-02-26 20:34:16 · 234 阅读 · 0 评论 -
1017 Queueing at Bank (25分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码3.1 未优化3.2 优化1 题目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 c...原创 2020-02-26 15:12:53 · 314 阅读 · 0 评论 -
1105 Spiral Matrix (25分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目1105 Spiral Matrix (25分)This time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral matrix is filled in...原创 2020-02-26 10:14:59 · 255 阅读 · 0 评论 -
1057 Stack (30分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目1057 Stack (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 Pu...原创 2020-02-25 10:52:22 · 274 阅读 · 0 评论 -
1068 Find More Coins (30分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目1068 Find More Coins (30分)Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping ...原创 2020-02-23 20:41:25 · 349 阅读 · 0 评论 -
1040 Longest Symmetric String (25分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目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 sy...原创 2020-02-23 10:14:41 · 317 阅读 · 0 评论 -
1045 Favorite Color Stripe (30分)
1 题目1045 Favorite Color Stripe (30分)Eva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off those unwanted...原创 2020-02-22 21:25:12 · 337 阅读 · 0 评论 -
1007 Maximum Subsequence Sum (25分)
1 题目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 Subseq...原创 2020-02-22 19:19:06 · 295 阅读 · 0 评论 -
最小生成树概念、最小生成树边权之和————附模版伪代码、实现代码、示例
文章目录1 概念1.1 定义1.2 性质2 求解最小生成树2.1 prim算法(普里姆算法)1 概念1.1 定义最小生成树:在一个给定的无向图G(V,E)中求一颗树T,使这棵树拥有图G中的所有顶点,且所有边都来自于图G中的边,并且满足整颗树的边权之和最小。1.2 性质1 最小生成树是树,因此其边数等于其顶点树减一,且树内一定不会有环;2 对于给定的图G(V,E),其最小生成树可以不唯...原创 2020-02-21 16:47:22 · 3874 阅读 · 0 评论 -
1087 All Roads Lead to Rome (30分)
1 题目1087 All Roads Lead to Rome (30分)Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the most ...原创 2020-02-21 12:16:30 · 383 阅读 · 0 评论 -
1072 Gas Station (30分)
1 题目1072 Gas Station (30分)A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as possible. However it mus...原创 2020-02-21 10:05:13 · 282 阅读 · 0 评论 -
1018 Public Bike Management (30分)
1 题目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 ...原创 2020-02-20 17:58:39 · 241 阅读 · 0 评论 -
1030 Travel Plan (30分)———— Dijkstra+DFS、SPFA
1 题目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 t...原创 2020-02-17 23:08:35 · 246 阅读 · 0 评论 -
1003 Emergency (25分)——Dijkstra(邻接表、邻接矩阵)、Bellman_Ford、SPFA
1 题目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 te...原创 2020-02-16 22:32:02 · 507 阅读 · 0 评论 -
1021 Deepest Root (25分)
1 题目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...原创 2020-02-15 22:01:09 · 233 阅读 · 0 评论 -
1013 Battle Over Cities (25分)
1 题目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....原创 2020-02-14 16:20:44 · 262 阅读 · 2 评论 -
1076 Forwards on Weibo (30分)
1 题目1076 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...原创 2020-02-14 10:57:47 · 277 阅读 · 0 评论 -
1034 Head of a Gang (30分)
1 题目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 o...原创 2020-02-13 22:04:31 · 394 阅读 · 0 评论 -
1098 Insertion or Heap Sort (25分)
1 题目1098 Insertion or Heap Sort (25分)According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort re...原创 2020-02-12 20:19:02 · 263 阅读 · 0 评论