PAT练习
文章平均质量分 87
幻世至上
while(life==true)Learning;
Leanring?happiness:sadness;
展开
-
【PAT】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 Subsequence is the continuous subsequ...原创 2018-03-22 13:23:09 · 231 阅读 · 0 评论 -
【PAT】1008. Elevator (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 specified order. It costs...原创 2018-03-22 14:56:29 · 190 阅读 · 0 评论 -
【PAT】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 four digits). 翻译:计算a+b然后按照标准格式输出——这代表数字...原创 2018-03-19 16:13:06 · 138 阅读 · 0 评论 -
【PAT】1002. A+B for Polynomials (25)
题目描述:This time, you are supposed to find A+B where A and B are two polynomials.翻译:这一次,你应当去完成两个多项式A和B的相加了。INPUT FORMATEach input file contains one test case. Each case occupies 2 lines, and eac...原创 2018-03-19 16:57:56 · 200 阅读 · 0 评论 -
【PAT】1009. Product of Polynomials (25)
题目描述This time, you are supposed to find A*B where A and B are two polynomials.翻译:这一次,你需要输出运算 A和B两个多项式的乘积。INPUT FORMATEach input file contains one test case. Each case occupies 2 lines, and e...原创 2018-03-23 15:24:06 · 138 阅读 · 0 评论 -
【PAT】1010. Radix (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 any pair of posi...原创 2018-03-23 18:35:23 · 375 阅读 · 1 评论 -
【PAT】1003. Emergency (25)【单源最短路问题/dijkstra算法】
题目描述: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 an...原创 2018-03-20 11:40:08 · 217 阅读 · 0 评论 -
【PAT】1011. World Cup Betting (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 World Cup trophy in South Afr...原创 2018-03-24 12:54:29 · 355 阅读 · 0 评论 -
【PAT】1012.The Best Rank (25) 【map容器使用】
题目描述: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 ...原创 2018-03-24 16:51:19 · 599 阅读 · 0 评论 -
【PAT】1004. Counting Leaves (30)【递归】
题目描述:A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.翻译:一个家族按层次经常用家谱(树型结构)来展示。你的任务是计算出这些家族成员哪些人没有孩子。INPUT FORMATEach i...原创 2018-03-20 17:39:48 · 155 阅读 · 0 评论 -
【PAT】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 a highest tree. Such a...原创 2018-03-30 16:28:11 · 173 阅读 · 0 评论 -
【PAT】1005. Spell It Right (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.翻译:给一个非负的整数N,你的任务是将N的所有数字相加求和,然后用英文输出和的每一位数字。INPUT FOR...原创 2018-03-21 08:36:54 · 132 阅读 · 0 评论 -
【PAT】1006. Sign In and Sign Out (25)【结构体+排序函数cmp】
题目描述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’...原创 2018-03-21 09:10:23 · 152 阅读 · 0 评论 -
【PAT】1022. Digital Library (30)【map的用法】
题目描述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 nu...原创 2018-03-30 18:24:09 · 129 阅读 · 0 评论 -
【PAT】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. We must know immediately if...原创 2018-03-25 15:30:22 · 152 阅读 · 0 评论 -
【PAT】1030. Travel Plan (30)【dijkstra算法】
题目描述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 ...原创 2018-04-08 12:50:02 · 172 阅读 · 0 评论 -
【PAT】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 happens to be another 9-digit numb...原创 2018-03-31 12:17:21 · 184 阅读 · 0 评论 -
【PAT】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 parts. The rules for the customers to wait in line are:Th...原创 2018-03-25 20:20:35 · 336 阅读 · 0 评论 -
【PAT】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 numbers are palindromic n...原创 2018-03-31 13:48:09 · 128 阅读 · 0 评论 -
【PAT】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 is, the characters ...原创 2018-04-08 15:53:38 · 168 阅读 · 0 评论 -
【PAT】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 system 73 is a reversible prime because its reverse 37 is als...原创 2018-03-26 12:46:26 · 184 阅读 · 0 评论 -
【PAT】1016. Phone Bills (25)【priority_queue和map的使用】
题目描述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...原创 2018-03-26 18:13:15 · 163 阅读 · 0 评论 -
【PAT】1032. Sharing (25)
题目描述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 ex...原创 2018-04-09 10:33:07 · 133 阅读 · 0 评论 -
【PAT】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 employees collaborate with g...原创 2018-04-14 11:55:50 · 97 阅读 · 0 评论 -
【PAT】1043. Is It a Binary Search Tree (25)【树的遍历】
题目描述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 ri...原创 2018-04-14 15:00:50 · 196 阅读 · 0 评论 -
【PAT】1017. Queueing at Bank (25)【priority_queue的运用】
题目描述: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 ye...原创 2018-03-27 15:42:22 · 173 阅读 · 0 评论 -
【PAT】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 way from time to time. Differ...原创 2018-04-09 22:10:42 · 139 阅读 · 0 评论 -
【PAT】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 places, and the rankl...原创 2018-04-02 22:50:04 · 225 阅读 · 0 评论 -
【PAT】1044. Shopping in Mars (25)【尺取法】
题目描述Shopping in Mars is quite a different experience. The Mars people pay by chained diamonds. Each diamond has a value (in Mars dollars M$). When making the payment, the chain can be cut at any pos...原创 2018-04-15 16:51:39 · 496 阅读 · 0 评论 -
【PAT】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 relation is defined t...原创 2018-04-10 11:25:42 · 717 阅读 · 0 评论 -
【PAT】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 distinguish 1 (one) from...原创 2018-04-10 12:46:57 · 225 阅读 · 0 评论 -
【PAT】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 return it to any other stations i...原创 2018-03-28 18:06:54 · 2900 阅读 · 3 评论 -
【PAT】1046. Shortest Distance (20)
题目描述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.翻译:这次的任务真的很简单:给你一条一个圆形高速公路上的N个出口,你需要说...原创 2018-04-16 16:54:06 · 138 阅读 · 0 评论 -
【PAT】1047. Student List for Course (25)【优先队列的使用】
题目描述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.翻译:...原创 2018-04-16 17:25:17 · 120 阅读 · 0 评论 -
【PAT】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 tables open when they arrive, they will be assigned to t...原创 2018-04-03 22:52:23 · 427 阅读 · 0 评论 -
【PAT】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 FORMATEac...原创 2018-04-11 14:03:47 · 292 阅读 · 0 评论 -
【PAT】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 the value of that pro...原创 2018-04-11 14:43:28 · 163 阅读 · 0 评论 -
【PAT】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 are for Red, the middle...原创 2018-04-04 17:23:58 · 130 阅读 · 0 评论 -
【PAT】1048.Find Coins (25)
题目描述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. Ho...原创 2018-04-17 15:22:57 · 130 阅读 · 0 评论 -
【PAT】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 single digit numbers are palindromic n...原创 2018-03-29 11:16:04 · 126 阅读 · 0 评论