
PAT甲级
文章平均质量分 91
分享自己PAT甲级的题解
Brielleqqqqqqjie
简单的事做到极致就是成功
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
PAT甲级解题目录
勉勉强强赶在春节期间完成了PAT二刷(有几题还需要加把劲),看自己一刷贴出来的代码,终于明白了那一句“这一定不是我写的代码”的无奈,二刷的代码尽量做好干净整洁,有多种方法的也尽可能一并写出来,希望奋斗路上的你也一起加油。编号 标题 题解 分类 1001 A+B Format C++ 字符串处理 1002 A+B for Polynomials...原创 2019-01-28 20:34:34 · 5555 阅读 · 3 评论 -
1005. Spell It Right (20)(C++)
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. Eac...原创 2018-02-26 13:38:12 · 278 阅读 · 0 评论 -
1007. Maximum Subsequence Sum (25)(C++)
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...原创 2018-02-26 15:12:41 · 245 阅读 · 0 评论 -
1019. General Palindromic Number (20)(C++)
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 numbers are palindromic numb...原创 2018-03-06 23:14:27 · 221 阅读 · 0 评论 -
1023. Have Fun with Numbers (20)(C++)
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 ...原创 2018-03-06 23:45:18 · 265 阅读 · 0 评论 -
1006. Sign In and Sign Out (25)(C++)
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...原创 2018-02-27 17:02:21 · 417 阅读 · 0 评论 -
1003. Emergency (25)(C++)
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 the l...原创 2018-02-28 22:41:31 · 436 阅读 · 0 评论 -
1024. Palindromic Number (25)(C++)
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 numbers are palindromic numbers...原创 2018-03-08 22:24:58 · 247 阅读 · 0 评论 -
1008. Elevator (20)(C++)
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 sec...原创 2018-03-01 15:18:37 · 403 阅读 · 0 评论 -
1009. Product of Polynomials (25)(C++)
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-03-01 16:12:09 · 422 阅读 · 0 评论 -
1011. World Cup Betting (20)(C++)
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. Si...原创 2018-03-01 21:35:18 · 300 阅读 · 1 评论 -
1012. The Best Rank (25)(C++)
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 Algebra), and E - Eng...原创 2018-03-03 13:06:47 · 328 阅读 · 3 评论 -
1001. A+B Format (20)(C++)
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...原创 2018-02-24 21:08:05 · 712 阅读 · 0 评论 -
1002. A+B for Polynomials (25)(C++)
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 line contains the information of a polyn...原创 2018-02-25 09:21:37 · 483 阅读 · 0 评论 -
1015. Reversible Primes (20)(C++)
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-03-05 22:31:01 · 263 阅读 · 0 评论 -
1013. Battle Over Cities (25)(C++)
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 nee...原创 2018-03-29 22:30:23 · 349 阅读 · 0 评论 -
1030. Travel Plan (30)(C++)
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 path b...原创 2018-04-08 22:58:09 · 277 阅读 · 0 评论 -
1025. PAT Ranking (25)(C++)
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 ranklists w...原创 2018-04-01 21:44:21 · 227 阅读 · 0 评论 -
1004. Counting Leaves (30)(c++)
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. Each case starts with a line...原创 2018-03-28 23:05:38 · 308 阅读 · 0 评论 -
1033. To Fill or Not to Fill (25)(C++)
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 way from time to time. Different ga...原创 2018-04-11 21:59:53 · 442 阅读 · 0 评论 -
1035. Password (20)(C++)
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 ...原创 2018-04-11 22:54:31 · 202 阅读 · 0 评论 -
1029. Median (25)(C++)
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...原创 2018-04-05 22:38:44 · 428 阅读 · 0 评论 -
1031. Hello World for U (20)(C++)
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-04-05 22:57:58 · 217 阅读 · 0 评论 -
1036. Boys vs Girls (25)(C++)
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 t...原创 2018-04-12 22:29:33 · 266 阅读 · 0 评论 -
1037. Magic Coupon (25)(C++)
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 product b...原创 2018-04-12 23:04:29 · 253 阅读 · 0 评论 -
1032. Sharing (25)(C++)
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 example,...原创 2018-04-06 23:12:24 · 227 阅读 · 0 评论 -
1046. Shortest Distance (20)(C++)
The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.Input Specification:Each input file conta...原创 2018-04-30 22:52:20 · 262 阅读 · 0 评论 -
1041. Be Unique (20)(C++)
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 ...原创 2018-04-19 23:46:45 · 285 阅读 · 0 评论 -
1047. Student List for Course (25)(C++)
Zhejiang University has 40000 students and provides 2500 courses. Now given the registered course list of each student, you are supposed to output the student name lists of all the courses.Input Spe...原创 2018-05-04 22:10:11 · 239 阅读 · 0 评论 -
1048. Find Coins (25)(C++)
Eva 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 payments. However,...原创 2018-05-04 22:58:23 · 569 阅读 · 0 评论 -
1045. Favorite Color Stripe (30)(C++)
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 pieces and sewing the remaining parts...原创 2018-04-29 22:16:10 · 263 阅读 · 0 评论 -
1129 Recommendation System(25 分)(C++)
Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recommendation system that rates the user's preference by the number of time...原创 2018-08-22 13:09:16 · 712 阅读 · 0 评论 -
1038 Recover the Smallest Number(30 分)(C++)
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 recover many numbers such like 32-321-3214-0229...原创 2018-08-26 12:08:19 · 258 阅读 · 0 评论 -
1039 Course List for Student(25 分)(C++)
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 comes ...原创 2018-08-26 13:53:22 · 509 阅读 · 0 评论 -
1042 Shuffling Machine(20 分)(C++)
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 gambler...原创 2018-08-27 13:04:07 · 328 阅读 · 0 评论 -
1043 Is It a Binary Search Tree(25 分)(C++)
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 than the node's key. The right su...原创 2018-08-27 13:52:35 · 459 阅读 · 0 评论 -
1010 Radix (25)(25 分)(C++)
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 in...原创 2018-08-23 14:02:06 · 412 阅读 · 0 评论 -
1063 Set Similarity(25 分)(c++)
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 numbers shared by the two sets, and Nt is the total number of ...原创 2018-08-30 17:31:10 · 192 阅读 · 0 评论 -
1049 Counting Ones(30 分)
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 i...原创 2018-08-27 18:30:04 · 248 阅读 · 0 评论 -
1050 String Subtraction(20 分)(c++)
Given two strings S1 and S2, S=S1−S2 is defined c++to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate S1−S2 for any give...原创 2018-08-27 22:17:08 · 298 阅读 · 0 评论