![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
pat甲级
文章平均质量分 77
qq285966121
哈哈哈
展开
-
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 cont原创 2017-02-17 19:42:43 · 147 阅读 · 0 评论 -
1002. A+B for Polynomials
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 p原创 2017-02-17 19:45:42 · 164 阅读 · 0 评论 -
1003. Emergency
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原创 2017-02-17 19:51:02 · 145 阅读 · 0 评论 -
1004. Counting Leaves
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原创 2017-02-17 19:56:18 · 155 阅读 · 0 评论 -
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.原创 2017-02-17 19:56:55 · 129 阅读 · 0 评论 -
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原创 2017-02-17 19:58:31 · 137 阅读 · 0 评论 -
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 Maximum Subsequence is the continuous subsequence which has the largest su原创 2017-02-17 20:00:21 · 153 阅读 · 0 评论 -
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 sec原创 2017-02-17 20:01:56 · 119 阅读 · 0 评论 -
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 i原创 2017-02-17 20:03:05 · 102 阅读 · 0 评论 -
1010. Radix
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原创 2017-02-17 20:04:12 · 136 阅读 · 0 评论 -
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. Si原创 2017-02-17 20:12:13 · 110 阅读 · 0 评论 -
1012. The Best Rank
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原创 2017-02-17 20:13:00 · 103 阅读 · 0 评论 -
1013. Battle Over Cities
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原创 2017-02-17 20:14:02 · 162 阅读 · 0 评论 -
1014. Waiting in Line
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 customers to wait in line are:The s原创 2017-02-17 20:16:41 · 112 阅读 · 0 评论 -
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原创 2017-02-17 20:20:03 · 129 阅读 · 0 评论 -
1016. Phone Bills
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 when the call is made. Wh原创 2017-02-17 20:21:52 · 137 阅读 · 0 评论 -
1017. Queueing at Bank
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 in line behind the yellow li原创 2017-02-17 20:24:42 · 534 阅读 · 0 评论 -
1019. General Palindromic Number
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原创 2017-02-17 20:30:43 · 164 阅读 · 0 评论 -
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 cor原创 2017-02-17 20:31:28 · 123 阅读 · 0 评论 -
1022. Digital Library
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 assigned an unique 7-digit number a原创 2017-02-18 19:48:21 · 141 阅读 · 0 评论 -
1021. Deepest Root
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 a highest tree. Such a root原创 2017-02-18 19:49:20 · 120 阅读 · 0 评论 -
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 con原创 2017-02-18 19:53:05 · 137 阅读 · 0 评论 -
1024. Palindromic Number
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原创 2017-02-18 19:54:04 · 116 阅读 · 0 评论 -
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 pr原创 2017-02-18 20:01:18 · 112 阅读 · 0 评论 -
1025. PAT Ranking
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原创 2017-02-18 20:07:18 · 120 阅读 · 0 评论 -
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 dig原创 2017-02-18 20:08:05 · 134 阅读 · 0 评论 -
1028. List Sorting
Excel can sort records according to any column. Now you are supposed to imitate this function.InputEach input file contains one test case. For each case, the first line contains two integers N原创 2017-02-18 20:08:40 · 137 阅读 · 0 评论 -
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原创 2017-02-18 20:09:09 · 118 阅读 · 0 评论 -
1030. Travel Plan
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原创 2017-02-18 20:09:58 · 114 阅读 · 0 评论 -
1032. Sharing
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,原创 2017-02-18 20:11:16 · 120 阅读 · 0 评论 -
1033. To Fill or Not to Fill
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原创 2017-02-18 20:12:26 · 202 阅读 · 0 评论 -
1034. Head of a Gang
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 relation is defined to be t原创 2017-02-18 20:14:35 · 157 阅读 · 0 评论 -
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原创 2017-02-18 20:15:18 · 169 阅读 · 0 评论 -
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 o原创 2017-02-18 20:15:47 · 160 阅读 · 0 评论 -
1037. Magic Coupon
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原创 2017-02-18 20:16:20 · 151 阅读 · 0 评论 -
1039. Course List for Student
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原创 2017-02-18 20:17:53 · 160 阅读 · 0 评论 -
1040. Longest Symmetric String
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-string is "s PAT&TAP s", hence you must原创 2017-02-18 20:19:17 · 120 阅读 · 0 评论 -
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原创 2017-02-19 19:47:47 · 168 阅读 · 0 评论 -
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 gambler原创 2017-02-19 19:49:34 · 142 阅读 · 0 评论 -
1043. Is It a Binary Search Tree
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 righ原创 2017-02-19 19:50:18 · 131 阅读 · 0 评论